遵循代理协议UIPopoverPresentationControllerDelegate
添加代码 :(button 是点击的控件)
```
- (void)userYourHandsButtonAction:(UIButton *)button{
//初始化提示框
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIPopoverPresentationController *popover = alert.popoverPresentationController;
if (popover) {
popover.sourceView = button;
popover.sourceRect = button.bounds;
popover.permittedArrowDirections = UIPopoverArrowDirectionAny;
}
[self presentViewController:alert animated:YES completion:nil];
}
```
网友评论