Simple login layout for ios Learning

Source: Internet
Author: User

Simple login layout for ios Learning

Haha, I am a local tyrant. I have to buy a mac and start to install it. I can't be idle when I buy it. By the way, I want to learn about ios and learn a simple login interface, all apps have logon interfaces. Start!

Let's take a look:

 

 

 

Click the code above:

 

//// MineUiViewController. m // UITabview /// Created by xiaoyuan on 15/4/16. // Copyright (c) 2015 xiaoyuan. all rights reserved. // # import MineUiViewController. h @ interface MineUiViewController ()
 
  
{UITextField * phone; UITextField * code; UIButton * btn; UIButton * getcode;} @ end @ implementation MineUiViewController-(void) viewDidLoad {[super viewDidLoad]; UILabel * title = [[UILabel alloc] initWithFrame: CGRectZero]; title. backgroundColor = [UIColor clearColor]; title. textColor = [UIColor whiteColor]; self. navigationItem. titleView = title; title. text = @; [title sizeToFit]; self. navigationController. navigationBar. barTintColor = [UIColor redColor]; [self. navigationController. navigationBar setTranslucent: NO]; int width = (self. view. frame. size. width); int leftandright = 6; int top = 6; phone = [[UITextField alloc] initWithFrame: CGRectMake (top, top, width * 2/3, 50)]; phone. textColor = [UIColor greenColor]; phone. font = [UIFont systemFontOfSize: 15]; phone. placeholder = @ enter the mobile phone number. phone. backgroundColor = [UIColor grayColor]; phone. returnKeyType = UIReturnKeyDefault; phone. keyboardType = UIKeyboardTypeDefault; phone. delegate = self; phone. keyboardType = UIKeyboardTypeNumberPad; [self. view addSubview: phone]; getcode = [[UIButton alloc] initWithFrame: CGRectMake (width * 2/3 + top * 2, top, width * 1/3-top * 3, 50)]; getcode. backgroundColor = [UIColor blackColor]; [getcode setTitle: @ fuck forState: UIControlStateNormal]; [getcode addTarget: self action: @ selector (getcode) forControlEvents :( UIControlEventTouchUpInside)]; [self. view addSubview: getcode]; int y = 50; y + = 20; code = [[UITextField alloc] initWithFrame: CGRectMake (top, y, width-top * 2, 50)]; code. textColor = [UIColor blueColor]; code. font = [UIFont systemFontOfSize: 15]; code. placeholder = @ enter the verification code. backgroundColor = [UIColor grayColor]; code. returnKeyType = UIReturnKeyDefault; code. keyboardType = UIKeyboardTypeDefault; code. delegate = self; code. keyboardType = UIKeyboardTypeNumberPad; [self. view addSubview: code]; y + = 50; y + = 20; btn = [[UIButton alloc] initWithFrame: CGRectMake (top, y, width-top * 2, 50)]; btn. backgroundColor = [UIColor redColor]; [btn setTitle: @ fuck forState: UIControlStateNormal]; [btn addTarget: self action: @ selector (getcode) forControlEvents: UIControlEventTouchUpInside]; [self. view addSubview: btn];}-(void) getcode {UIAlertView * show = [[UIAlertView alloc] initWithTitle: @ are you kidding me? message: @ you guess delegate: nil cancelButtonTitle: @ is otherButtonTitles: @ Yes, nil]; [show];}-(void) didReceiveMemoryWarning {[super didreceivemorywarning]; // Dispose of any resources that can be recreated .} @ en
 

 

If you want to enter this interface, you have to modify it in appdelegate:

 

//// AppDelegate. m // UITabview /// Created by xiaoyuan on 15/4/16. // Copyright (c) 2015 xiaoyuan. all rights reserved. // # import AppDelegate. h # import MineUiViewController. h @ interface AppDelegate () @ end @ implementation AppDelegate-(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( NSDictionary *) launchOptions {// Override point for customization after application launch. // create _ window = [[UIWindow alloc] initWithFrame: CGRectMake (0, 0,400,600)]; _ window. backgroundColor = [UIColor whiteColor]; MineUiViewController * rootVC = [[MineUiViewController alloc] init]; UINavigationController * nav = [[UINavigationController alloc] handler: rootVC]; _ window. rootViewController = nav; [_ window makeKeyAndVisible]; return YES;}-(void) applicationWillResignActive :( UIApplication *) application {// Sent when the application is about to move from active to inactive state. this can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. games shocould use this method to pause the game .} -(void) applicationDidEnterBackground :( UIApplication *) application {// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits .} -(void) applicationWillEnterForeground :( UIApplication *) application {// Called as part of the transition from the background to the inactive state; here you can undo records of the changes made on entering the background .} -(void) applicationDidBecomeActive :( UIApplication *) application {// Restart any tasks that were paused (or not yet started) while the application was inactive. if the application was previusly in the background, optionally refresh the user interface .} -(void) applicationWillTerminate :( UIApplication *) application {// Called when the application is about to terminate. save data if appropriate. see also applicationDidEnterBackground :.} @ end

 

 

 

Related Article

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.