大佬教程收集整理的这篇文章主要介绍了ipad – 在iOS8中更改Action Sheet popover箭头,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的代码:
UIAlertController *alertController = [UIAlertController alertControllerWithtitle:@"this is alert controller" message:@"yeah" preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertAction *cancelAction = [UIAlertAction actionWithtitle:NSLocalizedString(@"Cancel",@"Cancel action") style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { NSLog(@"Cancel action"); }]; UIAlertAction *okAction = [UIAlertAction actionWithtitle:NSLocalizedString(@"OK",@"OK action") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { NSLog(@"OK action"); }]; UIAlertAction *deleteAction = [UIAlertAction actionWithtitle:NSLocalizedString(@"delete",@"delete action") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { NSLog(@"delete action"); }]; [alertController addAction:cancelAction]; [alertController addAction:okAction]; [alertController addAction:deleteAction]; UIPopoverPresentationController *popover = alertController.popoverPresentationController; if (popover) { popover.sourceView = self.view; popover.sourceRect = self.view.bounds; popover.permittedArrowDirections = UIPopoverArrowDirectionUnkNown; } [self presentViewController:alertController animated:YES completion:nil];
[yourAlertController.popoverPresentationController setPermittedArrowDirections:0];
样品
UIAlertController *alertController = [UIAlertController alertControllerWithtitle:@"Test Action Sheet" message:@"message" preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertAction *cancelAction = [UIAlertAction actionWithtitle:@"Cancel" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { NSLog(@"Cancel action"); }]; UIAlertAction *okAction = [UIAlertAction actionWithtitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { NSLog(@"OK action"); }]; UIAlertAction *otherAction = [UIAlertAction actionWithtitle:@"Other" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { NSLog(@"Otheraction"); }]; [alertController addAction:okAction]; [alertController addAction:otherAction]; [alertController addAction:cancelAction]; // Remove arrow from action sheet. [alertController.popoverPresentationController setPermittedArrowDirections:0]; //For set action sheet to middle of view. alertController.popoverPresentationController.sourceView = self.view; alertController.popoverPresentationController.sourceRect = self.view.bounds; [self presentViewController:alertController animated:YES completion:nil];
产量
以上是大佬教程为你收集整理的ipad – 在iOS8中更改Action Sheet popover箭头全部内容,希望文章能够帮你解决ipad – 在iOS8中更改Action Sheet popover箭头所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。