3

在情节提要中,当您将 Segue 绘制到模态视图控制器时,您可以选择演示文稿、全屏、页面表、表单等的类型。

我正在展示来自 XIB 的模态视图控制器,并且它以全屏方式展示它。如何以编程方式将其更改为页面表或表单表?

4

1 回答 1

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];
于 2013-04-19T19:07:09.930 回答