The implementation of novice booting in iOS

Source: Internet
Author: User

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

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.