iOS Landing screen

Source: Internet
Author: User

Older code, for reference only

The main functional points involved are:
1, Password input box to hide the input characters, in place of black dots, and sometimes set a button on the edge, let the user choose whether to need ciphertext input
2, login will check the input box, if the input is not legal, pop-up window prompt users
3. Reset will empty the input
4, when you click on the blank space, you can put up the input keyboard to prevent users from clicking Login

5, pop-up keyboard to fit the input box, to ensure that the input box is not blocked by the keyboard

1, for the text box to hide the input, we just need to set its Securetextentry property to True is OK:

Object-c Code

Self.password.securetextentry=true;

2, the login function will save the user input to the appdelegate, so that in the future when the need for the program can also be taken:

-(ibaction) Login: (ID) sender{

NSString *username = [Self.userName.text stringbytrimmingcharactersinset:[nscharacterset whitespacecharacterset];

NSString *password = [Self.password.text stringbytrimmingcharactersinset:[nscharacterset whitespacecharacterset];

Appdelegate *delegate = (appdelegate *) [[uiapplication sharedapplication] delegate];

if (username.length==0| | password.length==0) {

Uialertview *alert= [[Uialertview alloc] initwithtitle:@ "Input invalid" message:@ "UserName or Password is empty" delegate : nil cancelbuttontitle:@ "OK" otherbuttontitles:nil, nil];

[Alert show];

Return

}

[Delegate.userstate setobject:username forkey:@ "Kusername"];

[Delegate.userstate setobject:password forkey:@ "Kpassword"];

Appdelegate *appdelegate = [[UIApplication sharedapplication] delegate];

AppDelegate.window.rootViewController = Appdelegate.tabbar;

}

3. At reset, in addition to emptying the contents of the UI control, you also need to empty the contents of the Appdelegate:

-(ibaction) Reset: (ID) sender{

[Email protected] "";

[Email protected] "";

Appdelegate *delegate = (appdelegate *) [[uiapplication sharedapplication] delegate];

[Delegate.userstate setobject:@ "" forkey:@ "Kusername"];

[Delegate.userstate setobject:@ "" forkey:@ "Kpassword"];

}

All methods that are bound to the UI space require a return type ibaction

iOS Landing screen

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.