使用 modalPresentationStyle 显示视图 [英] Display a view using modalPresentationStyle

查看:26
本文介绍了使用 modalPresentationStyle 显示视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说您可以使用 modalPresentationStyle 制作类似于 iPad 邮件应用程序中的视图弹出窗口.我很难弄清楚如何使用它.我看了这篇文章 这里,但仍然无法弄清楚如何完成这项任务.如果有人能解释如何连接控制器以使这段代码工作,那就太好了.

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.

谢谢

推荐答案

我觉得魔法咒语如下:

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.

这篇关于使用 modalPresentationStyle 显示视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆