[英]self.presentingViewController presentViewController not working
[英]presentViewController hides presentingViewController
有没有一种方法可以在iOS中呈现ViewController,同时保持呈现ViewController可见? 现在,动画结束后,PresentingViewController似乎被隐藏了。
使用UIModalPresentationStyle
的值来控制它。
UIModalPresentationPageSheet
或UIModalPresentationFormSheet
将导致演示,这些演示将在下面留下大量的演示视图控制器。
设置modalPresentationStyle
正被呈现的视图控制器上
例如
presentedViewController.modalPresentationStyle = UIModalPresentationFormSheet;
[presentingViewController presentViewController:presentedViewController animated:YES completion:nil];
节目:
if let popupVC = storyboard.instantiateViewControllerWithIdentifier("PopupVC") as? PopupVC
{
var frame = UIScreen.mainScreen().bounds
frame.origin.y = frame.size.height
overlayWindow = UIWindow(frame: frame)
popupVC.overlayWindow = overlayWindow
overlayWindow.windowLevel = UIWindowLevelAlert
overlayWindow.rootViewController = popupVC
overlayWindow.makeKeyAndVisible()
UIView.animateWithDuration(0.3, animations:
{
self.overlayWindow.frame.origin.y = 0
})
}
隐藏在PopupVC中
if let window = overlayWindow
{
UIView.animateWithDuration(0.3, animations: {
window.frame.origin.y = window.frame.height
}, completion: { (finished) -> Void in
self.overlayWindow = nil
})
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.