【发布时间】:2015-09-29 11:10:21
【问题描述】:
使用以下:
[self.actionSheetPostOptions showFromBarButtonItem:self.navigationItem.rightBarButtonItem animated:YES];
也试过了
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
message:nil
preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *actnCamera = [UIAlertAction actionWithTitle:@"Camera" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
}];
UIAlertAction *actnLibrary = [UIAlertAction actionWithTitle:@"Library" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
}];
[alertController addAction:actnLibrary];
[alertController addAction:actnCamera];
[alertController setModalPresentationStyle:UIModalPresentationPopover];
UIPopoverPresentationController *popPresenter = [alertController
popoverPresentationController];
popPresenter.barButtonItem = self.navigationItem.rightBarButtonItem;
[self presentViewController:alertController animated:YES completion:nil];
但在解雇时仍然遇到同样的问题。
更新iOS 11:iOS 11 中不再存在此问题。
【问题讨论】:
-
有同样的问题。对我来说,当我将位置从屏幕右侧更改为左侧时,它工作正常。有更新吗?
-
在我的情况下,Popover 应该只来自右键。所以添加了一个解决方法,禁用演示文稿上的视图动画。解雇后重新启用。它解决了我的问题。
-
这里有同样的问题。你是如何禁用视图动画的?
-
使用 [UIView setAnimationsEnabled:NO];在 UIAlertController 的演示文稿中禁用动画并在关闭时启用 ([UIView setAnimationsEnabled:YES];)。
-
尝试出现在主队列中
标签: objective-c ios9