iOS Learning: page jump (present)

Source: Internet
Author: User

////TWFXSECONDVIEWCONTROLLER.M//Demomultiview////Created by Lion User on 12-12-24.//Copyright (c) 2012 Lion User. All rights reserved.//#import "TWFXSecondViewController.h"#import "TWFXThirdViewController.h"@interfaceTwfxsecondviewcontroller ()@end@implementationTwfxsecondviewcontroller@synthesizeThirdviewcontroller;- (ID) Initwithnibname: (NSString *) Nibnameornil Bundle: (NSBundle *) nibbundleornil{ Self=[Super Initwithnibname:nibnameornil Bundle:nibbundleornil]; if(self) {//Custom Initialization    }    returnSelf ;}- (void) viewdidload{[Super Viewdidload]; //Do any additional setup after loading the view from its nib.}- (void) didreceivememorywarning{[Super didreceivememorywarning]; //Dispose of any resources the can be recreated.}/*multi-View switch, if you jump from a view to B view, then A is the current view, b means that you want to jump to the view multi-view jump can be understood to have two parts: jump from A to B, B to return a. Note that is returned, not re-initiating the jump here is the second stage: return A from B Self.presentingviewcontroller is valid after the jump occurs, representing the previous view of the B attempt, where a view self.presentedviewcontroller is valid after the jump occurs, representing the next view of B view, Here for nil, thought that did not happen jump Self.parentviewcontroller represents B's parent attempt, also nil*/-(Ibaction) Btnclicgoback: (UIButton *) sender{void(^task) () = ^{NSLog (@"2self:%@", self); NSLog (@"2back ed%@", Self.presentedviewcontroller); NSLog (@"2back ing%@", Self.presentingviewcontroller); //NSLog (@ "Back par%@", Self.parentviewcontroller);printf"\ n");       }; //task (); //call Completion when the jump is complete, at which point the current view has been destroyed and Self.presentedviewcontroller Self.presentingviewcontroller are nil[self dismissviewcontrolleranimated:yes completion:nil]; Task ();//at this point, the current view has not been destroyed and Self.presentingviewcontroller represents the previous view}-(Ibaction) Btnclicktratofirst: (UIButton *) Sender {}/*This means jumping from B view to C view*/-(Ibaction) Btnclicktra: (UIButton *) Sender {if(Self.thirdviewcontroller = =Nil) {                /*The most commonly used initialization method Nibname represents the name of the Xib file, excluding the extension nibbundle the development of a nib file in that file bundle, such as in the home directory, you can directly use nil 
    */Self.thirdviewcontroller= [[[[Twfxthirdviewcontroller alloc] Initwithnibname:@"Twfxthirdviewcontroller"Bundle:nil]autorelease]; }        //animation effect of view toggleSelf.thirdViewController.modalTransitionStyle =uimodaltransitionstylecoververtical; void(^task) () = ^{NSLog (@"2self:%@", self); NSLog (@"2go ed%@", Self.presentedviewcontroller); NSLog (@"2go ing%@", Self.presentingviewcontroller); //NSLog (@ "Go par%@", self.parentviewcontroller);printf"\ n");    }; //task = ^ () {}; //task ();//no meaning before jumping            /*completion is a callback that is called Self.presentingviewcontroller (represents the previous view) after the viewdiddisear call of the current view (here is Twfxviewcontroller) Self.presentedviewcontroller for a view (indicates the next attempt) is C view*/[self Presentviewcontroller:thirdviewcontroller animated:yes completion:task]; }@end

iOS Learning: page jump (present)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.