[英]How to dismiss UIPopover from a button in the Popover with IOS 8 XCode 6 beta
我设法使用UIPopoverPresentationController
显示UIPopoverPresentationController
因为UIPopoverController
在IOS 8中已被弃用,但现在我想从UIPopoverController
中关闭按钮上的popover。
怎么可以被解雇?
使用UIViewController的presentsViewController属性来关闭。 例如:出席
vc.modalPresentationStyle = UIModalPresentationPopover;
vc.preferredContentSize = aPreffferedSize;
UIPopoverPresentationController *popcontroller = vc.popoverPresentationController;
popcontroller.barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:view];
popcontroller.permittedArrowDirections = UIPopoverArrowDirectionAny;
popcontroller.delegate = self;
[self presentViewController:vc animated:YES completion:nil];
要以编程方式解雇,
[[vc presentingViewController] dismissViewControllerAnimated:YES completion:NULL];
希望这可以帮助。
我在用
dismissViewControllerAnimated(true, completion: nil)
在类似场景中按钮的IBAction中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.