更改模态视图的演示文稿类型?

时间:2013-04-19 18:57:59

标签: ios objective-c modal-dialog segue

在故事板中绘制Segue到模态视图控制器时,您可以选择演示文稿类型,全屏,页面表,表单等。

我正在从XIB呈现一个模态视图控制器,它以全屏显示它。如何以编程方式将其更改为页面表或表单?

1 个答案:

答案 0 :(得分:7)

UIViewController(代码)中,您可以设置新UIViewController的展示方式。您可以访问的属性:

@property(nonatomic, assign) UIModalTransitionStyle modalTransitionStyle

不同的类型:

typedef enum {
   UIModalPresentationFullScreen = 0,
   UIModalPresentationPageSheet,
   UIModalPresentationFormSheet,
   UIModalPresentationCurrentContext,
} UIModalPresentationStyle;

在代码中:

MyViewController *controllerThatWillBePresented = ...
controllerThatWillBePresented.modalTransitionStyle = // The one you want
[self presentModalViewController:controllerThatWillBePresented animated:YES];