问题
I'm presenting a list of options to the user using an UIAlertController from a UIToolbar with a preferred style of action sheet. When presented, the popover's arrow is cut off and its corners are rounded with two different radii:

The code I'm using to present it is straight from the documentation, as far as I see it:
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];
Is this a known bug? I've tried a physical iPad on iOS 8.2 and the simulator on iOS 8.1 and 8.2.
回答1:
Try explicitly setting the permittedArrowDirections.
For example in Swift:
actionSheet.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.Down;
来源:https://stackoverflow.com/questions/29195302/uialertcontrollers-popover-is-deformed