我使用UIToolbar中的UIAlertController向用户显示一个选项列表,其中包含首选的操作表样式。呈现时,弹出的箭头被切掉,其角落呈圆形,有两个不同的半径:
我用来呈现它的代码直接来自文档,据我所知:
UIAlertController *alertController =
[UIAlertController alertControllerWithTitle:@""
message:@""
preferredStyle:UIAlertControllerStyleActionSheet];
NSArray *actions = @[
[UIAlertAction actionWithTitle:@"Take a Photo"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {}],
[UIAlertAction actionWithTitle:@"Choose from Album"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {}],
[UIAlertAction actionWithTitle:@"Cancel"
style:UIAlertActionStyleCancel
handler:^(UIAlertAction *action) {}]
];
for (UIAlertAction *action in actions) {
[alertController addAction:action];
}
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
alertController.modalPresentationStyle = UIModalPresentationPopover;
alertController.popoverPresentationController.barButtonItem = myBarButtonItem;
}
[self presentViewController:alertController animated:YES completion:nil];
这是一个已知的错误吗?我在iOS 8.2和iOS 8.1和8.2上的模拟器上尝试过物理iPad。
答案 0 :(得分:0)
尝试明确设置allowedArrowDirections。
例如在Swift中:
actionSheet.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.Down;