There are four ways to switch modal on the ipad, vertical entry (bottom to top, default), flip horizontally, fade in and out.
property to be set on the controller that will be modal:
/* typedef ns_enum (Nsinteger, Uimodaltransitionstyle) { uimodaltransitionstylecoververtical = 0, Uimodaltransitionstylefliphorizontal, Uimodaltransitionstylecrossdissolve, Uimodaltransitionstylepartialcurl Ns_enum_available_ios (3_2), }; * ///Note iOS7 page (Uimodaltransitionstylepartialcurl) can only leak out of the controller below, note that the page can only be used when the controller full screen. Vc.modaltransitionstyle = uimodaltransitionstylecoververtical;
In addition to the way of entry, there are display methods, commonly used to display the way is Formsheet, this method will not be full-screen display, but in the middle of the screen in the small area display. PageSheet displays a page with a fixed width of 768 points and a height that varies with the screen.
/* typedef ns_enum (Nsinteger, Uimodalpresentationstyle) { Uimodalpresentationfullscreen = 0, Uimodalpresentationpagesheet Ns_enum_available_ios (3_2), uimodalpresentationformsheet NS_ENUM_AVAILABLE_IOS ( 3_2), uimodalpresentationcurrentcontext Ns_enum_available_ios (3_2), uimodalpresentationcustom NS_ENUM_ Available_ios (7_0), uimodalpresentationoverfullscreen Ns_enum_available_ios (8_0), Uimodalpresentationovercurrentcontext Ns_enum_available_ios (8_0), uimodalpresentationpopover NS_ENUM_ Available_ios (8_0), uimodalpresentationnone ns_enum_available_ios (7_0) =-1, };*/ // PageSheet width fixed to 768, height for current screen height //Formsheet show a small block in the center, common, attention and popover differentiated. Vc.modalpresentationstyle = Uimodalpresentationformsheet;
Modal is the same way as the original method, and dismiss in the way you set out.
[Self PRESENTVIEWCONTROLLER:VC animated:yes completion:nil];
The complete code for Touch modal controller 2 from controller 1 is as follows:
-(void) Touchesbegan: (Nsset *) touches withevent: (uievent *) event{ViewController2 *VC = [[ViewController2 alloc] In It]; Vc.view.backgroundColor = [Uicolor Redcolor]; /* typedef ns_enum (Nsinteger, uimodaltransitionstyle) {uimodaltransitionstylecoververtical = 0, Uimodaltransi Tionstylefliphorizontal, Uimodaltransitionstylecrossdissolve, Uimodaltransitionstylepartialcurl NS_ENUM_AVAILABLE _ios (3_2),}; *///Note iOS7 page (Uimodaltransitionstylepartialcurl) can only leak out of the controller below, note that the page can only be used when the controller full screen. Vc.modaltransitionstyle = uimodaltransitionstylecoververtical; /* typedef ns_enum (Nsinteger, uimodalpresentationstyle) {uimodalpresentationfullscreen = 0, Uimodalprese Ntationpagesheet Ns_enum_available_ios (3_2), Uimodalpresentationformsheet Ns_enum_available_ios (3_2), UIModa Lpresentationcurrentcontext Ns_enum_available_ios (3_2), Uimodalpresentationcustom NS_ENUM_AVAILABLE_IOS (7_0), UimodalpresentationoveRfullscreen Ns_enum_available_ios (8_0), Uimodalpresentationovercurrentcontext Ns_enum_available_ios (8_0), UI Modalpresentationpopover Ns_enum_available_ios (8_0), Uimodalpresentationnone ns_enum_available_ios (7_0) =-1,}; *//PageSheet width fixed to 768, height for current screen height//formsheet in the center show a small piece, commonly used, note and PopOver differentiated. Vc.modalpresentationstyle = Uimodalpresentationformsheet; [Self PRESENTVIEWCONTROLLER:VC animated:yes completion:nil];
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
(107) How to switch and display the modal of ipad development