Support gesture swipe back after using the self-brought push return 7.0.
1. Encapsulate a separate class to keep user logon information create a new class
Add Singleton.h header file definition properties in the. h file
And then to the. m file, define Single_implementation (Loginuser)
and import Nsstring+helper.h header files
and #define Kxmppusernamekey @ "Xmppusername"
#define Kxmpppasswordkey @ "Xmpppassword"
#define Kxmpphostnamekey @ "Xmpphostname"
Determine if isemptystring is empty string, only need to return (Self.length ==0);
-(NSString *) Loadstringfromdefaultswithkey: (NSString *) key
{
NSString *str = [[Nsuserdefaults standarduserdefaults] stringforkey:key];
return (str)? STR: @ "";
}
-(NSString *) userName
{return [self loadstringfromdefaultswithkey:kxmppusernamekey];}
-(void) Setusername: (NSString *) userName
{[UserName savetonsdefaultswithkey:kxmppusernamekey];}
-(NSString *) password
{return [self loadstringfromdefaultswithkey:kxmpppasswordkey];}
-(void) SetPassword: (NSString *) password
{[Password Savetonsdefaultswithkey:kxmpppasswordkey];}
-(NSString *) hostName
{return [self loadstringfromdefaultswithkey:kxmpphostnamekey];}
-(void) SetHostName: (NSString *) hostName
{[HostName savetonsdefaultswithkey:kxmpphostnamekey];}
This method of myjidname is defined in the. h file.
-(NSString *) myjidname
{return [NSString stringwithformat:@ "%@@%@", Self.username, Self.hostname];}
2. Import the newly created class in the login file.
Set the initial value of the interface text below the login and registration button
_usernametext.text = [[Loginuser sharedloginuser] userName];
_passwordtext.text = [[Loginuser sharedloginuser] password];
_hostnametext.text = [[Loginuser sharedloginuser] hostName];
Set Text Focus ... (The text box is empty automatically when the light box is anchored to the text box)
if ([_usernametext.text isemptystring]) {
[_usernametext Becomefirstresponder];
} else {
[_passwordtext Becomefirstresponder];
}
2. Write user logon information to System Preferences
[[Loginuser Sharedloginuser] setusername:username];
[[Loginuser Sharedloginuser] setpassword:password];
[[Loginuser Sharedloginuser] sethostname:hostname];
6. New. User login model and login Interface Focus processing