ViewController.h
#import "ViewController.h"@interfaceViewcontroller () @property (strong,nonatomic) Uiimageview*Beijing, @property (strong,nonatomic) Uiimageview*Welcome, @property (strong,nonatomic) Uiimageview*Phoneicon, @property (strong,nonatomic) Uitextfield*Intele, @property (strong,nonatomic) UIView*Inteleview, @property (strong,nonatomic) Uiimageview*Passwordicon, @property (strong,nonatomic) Uitextfield*Inpassword, @property (strong,nonatomic) UIView*Inpasswordview, @property (strong,nonatomic) Uiimageview*logo; @property (strong,nonatomic) UIButton*Loginbutton, @property (strong,nonatomic) UIButton*Rigisterbutton;@end
Viewcontroller.m
@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; //Add parent View Beijing background mapSelf.beijing=[[uiimageview Alloc] Initwithframe:cgrectmake (0,0, Self.view.frame.size.width, Self.view.frame.size.height)]; //Insert Picture[Self.beijing setimage:[uiimage imagenamed:@"Beijing"]]; [Self.view addSubview:self.beijing]; //Add a child view welcome background mapSelf.welcome=[[uiimageview Alloc] Initwithframe:cgrectmake ( $, $,318, -)]; //Insert Picture[Self.welcome setimage:[uiimage imagenamed:@"Welcome"]]; //Insert Child View[Self.view AddSubview:self.welcome]; //add Phoneicon input iconSelf.phoneicon=[[uiimageview Alloc] Initwithframe:cgrectmake ( the,122, -, -)]; //Insert Picture[Self.phoneicon setimage:[uiimage imagenamed:@"Phoneicon"]]; [Self.view AddSubview:self.phoneIcon]; //Add phone number input boxSelf. Intele=[[uitextfield Alloc] Initwithframe:cgrectmake ( About,122,267, +)]; //Set Stealth WordsSelf. Intele.placeholder=@"Please enter your mobile phone number"; //setting up a numeric pop-up keyboardSelf. Intele.keyboardtype=Uikeyboardtypenumberpad; //set the Uitextfield without BordersSelf. intele.borderstyle=Uitextborderstylenone; [Self.view addsubview:self. Intele]; Self. Inteleview=[[uiview Alloc] Initwithframe:cgrectmake ( the, the, -,1)]; Self. Inteleview.backgroundcolor=[Uicolor Whitecolor]; [Self.view addsubview:self. Inteleview]; //Add password entry boxSelf. Inpassword=[[uitextfield Alloc] Initwithframe:cgrectmake ( About,182,267, +)]; Self. Inpassword.placeholder=@"Please enter your password"; Self. Inpassword.securetextentry=YES; Self. Inpassword.borderstyle=Uitextborderstylenone; [Self.view addsubview:self. Inpassword]; Self. Inpasswordview=[[uiview Alloc] Initwithframe:cgrectmake ( the,213, -,1)]; Self. Inpasswordview.backgroundcolor=[Uicolor Whitecolor]; [Self.view addsubview:self. Inpasswordview]; //add Passwordicon input iconSelf.passwordicon=[[uiimageview Alloc] Initwithframe:cgrectmake ( the,182, -, -)]; [Self.passwordicon setimage:[uiimage imagenamed:@"Passwordicon"]]; [Self.view AddSubview:self.passwordIcon]; //Add logo background imageSelf.logo=[[uiimageview Alloc] Initwithframe:cgrectmake (173,694, the, A)]; [Self.logo setimage:[uiimage imagenamed:@"logo"]]; [Self.view AddSubview:self.logo]; //settings related to the login buttonSelf.loginbutton=[[uibutton Alloc] Initwithframe:cgrectmake ( the,282,318, -)]; [Self.loginbutton setbackgroundimage:[uiimage imagenamed:@"Loginbutton"] Forstate:uicontrolstatenormal]; [Self.loginbutton settitle:@"Login"Forstate:uicontrolstatenormal]; //Event Monitoring[Self.loginbutton addtarget:self Action: @selector (Hidekeyboard) forcontrolevents:uicontroleventtouchupinside] ; [Self.view AddSubview:self.loginButton]; //Registration button SettingsSelf.rigisterbutton=[[uibutton Alloc] Initwithframe:cgrectmake ( the,338,318, -)]; [Self.rigisterbutton setbackgroundimage:[uiimage imagenamed:@"Rigisterbutton"] Forstate:uicontrolstatenormal]; [Self.rigisterbutton settitle:@"Register"Forstate:uicontrolstatenormal]; //Event Monitoring[Self.rigisterbutton addtarget:self Action: @selector (Hidekeyboard) forControlEvents: UIControlEventTouchUpInside]; [Self.rigisterbutton Settitlecolor:[uicolor Greencolor] forstate:uicontrolstatenormal]; [Self.view AddSubview:self.rigisterButton]; }//Click the blank area to hide the keyboard-(void) Touchesbegan: (Nsset<uitouch *> *) touches withevent: (Uievent *)Event{[self hidekeyboard];}-(void) hidekeyboard{if([Self. Intele isfirstresponder]| |[Self. Inpassword Isfirstresponder]) {[Self. Intele Resignfirstresponder]; [Self. Inpassword Resignfirstresponder]; } }
Operation Result:
Ios--app Login Interface Diagram (Xuer)