As a new handwritten note, it is convenient for you to remember:
From Android to the iOS, for the page jump, looking for a lot of information, now record the page jump method.
1. With Navigationcontroller
2. Jump directly (just found on the internet, not too familiar, wrong Mo Strange)
1. Build a Rootviewcontroller, in delegate.h
Copy Code code as follows:
@property (Strong, nonatomic) Uiviewcontroller *viewcontroller;
@property (Strong, nonatomic) Uinavigationcontroller *navcontroller;
Write code in the DELEGATE.M code didfinishlaunchingwithoptions function:
Rootviewcontroller *rootview = [[Rootviewcontroller alloc] init];
Rootview.title = @ "Root View";
Self.navcontroller = [[Uinavigationcontroller alloc] init];
[Self.navcontroller Pushviewcontroller:rootview Animated:yes];
[Self.window AddSubview:self.navController.view];
The code loads the first page Rootviewcontroller.
Jump to another page (such as Subviewcontroller) code:
Copy Code code as follows:
Subviewcontroller *subview = [[Subviewcontroller alloc] init];
[Self.navigationcontroller Pushviewcontroller:subview Animated:yes];
Subview.title = @ "Sub";
The benefit is that the return button is automatically generated.
2. Direct jump, nothing
Do not need to do other redundant, directly create a View object
Copy Code code as follows:
Subviewcontroller *subview = [[Subviewcontroller alloc] initwithnibname:@ "Subviewcontroller" Bundle:[NSBundle Mainbundle]];
[Self Presentmodalviewcontroller:subview animated:yes];
That's good.
iOS6.0 doesn't use this function after all.
Copy Code code as follows:
[Self Presentmodalviewcontroller:subview animated:yes];
Can replace
Copy Code code as follows:
[Self Presentviewcontroller:subview animated:yes completion:nil];
Data transfer when a page jumps
For example, in the need to implement View1 jump to View2, the view1 of some of the data passed to View2
Ideas:
1. Customize a bean class user and implement user as a member variable in VIEW2.
2.view1 the data into user when it jumps, and assigns it to View2.user
Code
1. View2
. h declaring member variables
Copy Code code as follows:
@property (Strong, nonatomic) User *user;
2. View1
Copy Code code as follows:
View2 *view2 = [[View2 alloc] init];
User *user = [[User alloc] init];
User.Name = @ "Kevin";
View2.user = user;
[Self.navigationcontroller Pushviewcontroller:view2
Animated:yes];
3. View2
Take the variable
Copy Code code as follows: