在ipad開發(fā)中,ios9中的UIPopoverController 運用的非常多,它繼承的不是ViewController 而是NSObject,這就說它的顯示依靠其他視圖控制器,但是在ios10中它被廢棄了用p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px STXinwei; color: #00afca}span.s1 {font-variant-ligatures: no-common-ligatures}
UIPopoverPresentationController替代,雖然可以使用作為程序員跟著Apple公司走是沒錯的,實現(xiàn)內(nèi)容和顯示大致如下:

QQ20161225-0.png
iOS9 初始化代碼:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *controller = [storyboard instantiateViewControllerWithIdentifier:@"PopContentController"];
UIPopoverController *popVc = [[UIPopoverController alloc] initWithContentViewController:controller];
[popVc presentPopoverFromBarButtonItem:self.leftButton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
iOS10 的使用
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *controller = [storyboard instantiateViewControllerWithIdentifier:@"PopContentController"];
controller.modalPresentationStyle = UIModalPresentationPopover;
[self presentViewController:controller animated:YES completion:nil];
// configure the Popover presentation controller
UIPopoverPresentationController *popController = [controller popoverPresentationController];
popController.permittedArrowDirections = UIPopoverArrowDirectionAny;
popController.barButtonItem = self.leftButton;
popController.delegate = self;