Display a view using modalPresentationStyle

跟風遠走 提交于 2019-12-04 13:31:35

问题


I have heard that you can make a view popup like in the Mail app for iPad by using modalPresentationStyle. Im having a hard time figuring out how to use it though. I looked a this post here and still couldn't figure out how to do this task. If anyone could explain how to hook up the controllers to make this code work that would be great.

Thanks


回答1:


I think the magic incantation is the following:

myViewController = ..... create your new controller if needed ....
myViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
myViewController.modalPresentationStyle = UIModalPresentationFormSheet;
// "self" here is a ViewController instance
[self presentModalViewController:myViewController animated:YES]

I seem to recall that in portrait the modal takes over the screen; in landscape it will be presented centered in the view.



来源:https://stackoverflow.com/questions/2694332/display-a-view-using-modalpresentationstyle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!