1. Due to the needs of the project, I learned the Novice's guidance today, and then I'm going to use the Novice boot method: (Run once in the program) next is the implementation code:
In the APPDELEGATE.M code:
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {
Uiviewcontroller *root;
BOOL answer= [[nsuserdefaults standarduserdefaults]boolforkey:@ "Answer"];
if (!answer) {
root = [[WecomeViewController1 alloc]init]; Welcome to the interface, is to introduce new features of the product
}
else{
root = [[Testviewcontroller alloc]init];
}
Self.window.rootViewController = root;
[Self.window makekeyandvisible];
return YES;
}
The code that is implemented when a call is required is:
-(void) touchesended: (Nsset *) touches withevent: (uievent *) event{
NSString *anwerlabel = Self.anwerLabel.text;
if ([Anwerlabel isequaltostring:@ ""]) {
[Self showstring:@ "wrong answer, don't be too angry!"];
Return
}
if ([Anwerlabel isequaltostring:@ "1234"]) {
[Self showstring:@ "Congratulations on your answer!"];
Testviewcontroller *TESTVC = [[Testviewcontroller alloc]init];
[Self PRESENTVIEWCONTROLLER:TESTVC animated:no completion:nil];
//Set here to determine if it is the first time, then set the sync
[[Nsuserdefaults standarduserdefaults]setbool:yes forkey:@ "Answer"];
[[Nsuserdefaults standarduserdefaults]synchronize];
}
}
Hope can help people in need! Welcome to your valuable comments!!
The implementation of novice booting in iOS