UIAlertController的弹出窗口形状不正常

6

我正在使用UIToolbar和preferred style为action sheet的UIAlertController向用户展示选项列表。当弹出时,气泡箭头被切断,并且其角落有两个不同的半径:

Deformed UIAlertController popover

我使用的代码直接来自文档,据我所见:

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];

这是一个已知的 bug 吗?我已经尝试了运行在 iOS 8.2 上的 iPad 和模拟器,还有运行在 iOS 8.1 和 8.2 上的模拟器。


我也在遇到这个问题。你有什么进展吗? - devios1
如果您将@""替换为nil会发生什么? - Duck
1个回答

0

尝试明确设置允许的箭头方向。

例如在Swift中:

actionSheet.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.Down;

我实际上能够重现你的问题,它发生在我改变设备方向后,然后切换回原始方向。 - Alexis Candelaria

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接