如何使用IOS 8 XCode 6 beta从Popover中的按钮关闭UIPopover

前端之家收集整理的这篇文章主要介绍了如何使用IOS 8 XCode 6 beta从Popover中的按钮关闭UIPopover前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我设法使用UIPopoverPresentationController显示popover,因为UOSopoverController在 IOS 8中已被弃用,但现在我想从popover中关闭按钮上的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];

希望这可以帮助.

猜你在找的Xcode相关文章