现在的位置: 首页 > 综合 > 正文

iOS4.0开发——Modal a Controller的不同呈现类型modalPresentationStyle

2013年11月06日 ⁄ 综合 ⁄ 共 635字 ⁄ 字号 评论关闭

ModalViewController可以有不同的呈现类型(modalPresentationStyle),列举如下:

1. UIModalPresentationFullScreen // 全屏模式。即弹出窗口占满整个屏幕,在portrait模式和landscape模式下都一样。

2. UIModalPresentationFormSheet // 会将窗口缩小,使之居于屏幕中间。在portraitlandscape下都一样,但要注意landscape下如果软键盘出现,窗口位置会调整。

3. UIModalPresentationPageSheet // portrait时是FullScreen,在landscape时和FormSheet模式一样。

4. UIModalPresentationCurrentContext // (没用过)

// 例:在类ControllerA中弹出类ControllerB UITableViewController

// 在类ControllerA对应的方法中实现

ControllerB *cb = [[[ControllerB alloc] initWithNibName:nil bundle:nil] autorelease];

cb.modalPresentationStyle = UIModalPresentationFormSheet;

[self presentModalViewController:cb animated:YES];

抱歉!评论已关闭.