在StoryBoard中设置弹出Model ViewController时,将segue的presentation项选择为除了UIModalPresentationCurrentContext和Default(它代表目标视图控制器的presentation属性设置,如果目标属性为CurrentContext那么也会发生)之外,当内存紧缺时,父视图都不会viewDidUnload,而XCode3.2则不在呼这一设置,让我很是费解啊。
如果想在多于二层的视层控制器保证最后一个视图可以半透显示在上层的话,你必须将最开始的那层视图控制器设置为CurrentContext,但是也导致了它会视图释放掉,然后将segue的presentation置为UIModalPresentationFullScreen,如果该视图还有子视图弹出那就在执行segue时再执行代码:
((UIViewController*)segue.sourceViewController).modalPresentationStyle = UIModalPresentationCurrentContext;
Presentation Styles
Presentation styles available when presenting view controllers.
typedef enum {
UIModalPresentationFullScreen = 0,
UIModalPresentationPageSheet,
UIModalPresentationFormSheet,
UIModalPresentationCurrentContext,
} UIModalPresentationStyle;
Constants
-
The presented view covers the screen, taking into account the value of the
wantsFullScreenLayout
property.Available in iOS 3.2 and later.
Declared in
UIViewController.h
.
UIModalPresentationFullScreen
-
The height of the presented view is set to the height of the screen and the view’s width is set to the width of the screen in a portrait orientation. Any uncovered areas are dimmed to prevent the user from interacting with them. (In portrait orientations, this option is essentially the same as
UIModalPresentationFullScreen
.)Available in iOS 3.2 and later.
Declared in
UIViewController.h
.
UIModalPresentationPageSheet
-
The width and height of the presented view are smaller than those of the screen and the view is centered onscreen. If the device is in a landscape orientation and the keyboard is visible, the position of the view is adjusted upward so the view remains visible. All uncovered areas are dimmed to prevent the user from interacting with them.
Available in iOS 3.2 and later.
Declared in
UIViewController.h
.
UIModalPresentationFormSheet
-
The view is presented using the same style as its parent view controller.
When presenting a view controller in a popover, this presentation style is supported only if the transition style is
UIModalTransitionStyleCoverVertical
. Attempting to use a different transition style triggers an exception. However, you may use other transition styles (except the partial curl transition) if the parent view controller is not in a popover.Available in iOS 3.2 and later.
Declared in
UIViewController.h
.
UIModalPresentationCurrentContext