这是什么类型的视图控制器?

时间:2013-05-18 03:49:05

标签: ios uiviewcontroller

你是如何创造它的? - 中间的弹出窗口

http://blogs.plos.org/mfenner/files/2011/01/IMG_0040-500x375.jpg

我会谎言在我的游戏中使用这样的东西(在主菜单中)。

3 个答案:

答案 0 :(得分:1)

UIViewController没有类型。您可以通过不同的方式展示UIViewController

iPad支持以下三种类型:

  1. 全屏
  2. Page Sheet
  3. From Sheet
  4. 您的图片显示第三个UIModalPresentationFormSheet

    您可以在以下应用指南中找到有关如何使用这三种演示文稿的详细信息: Presenting View Controllers from Other View Controllers

答案 1 :(得分:0)

这是文档的链接。

Presenting View Controllers from Other View Controllers

模态视图控制器是一个可以在另一个控制器之上呈现的控制器。

例如,要创建它,您只需调用当前视图控制器的presentViewController:animated:completion:方法,传入要显示的视图控制器。

由于您上传的界面包含一个包含关闭栏按钮项的导航栏,因此您只需将要显示的控制器包裹在导航控制器中即可。

YourViewController *yourViewController = [[YourViewController alloc] init];

UINavigationController *navigationController = [[UINavigationController alloc]
                             initWithRootViewController:yourViewController];
[self presentViewController:navigationController animated:YES completion: nil];

否则,您可以创建一个普通控制器并使用UIToolBar

希望有所帮助。

P.S。关闭按钮不会免费提供。你需要添加它;)

答案 2 :(得分:0)

我认为使用第三方库而不是实现它会好得多。有许多库提供类似的功能。

如果您不想使用上述库,可以在本文档中使用Apple解释的UIModalPresentationFormSheet:Presenting View Controllers from Other View Controllers

希望这有帮助!