I. Login module
- Login logic
1-(Ibaction) Loginclick: (UIButton *) Sender {2 3self.view.userInteractionEnabled =NO;4 5 [Self.view Endediting:yes];6 7 [Self.activeview startanimating];8 9 if(Self.accountField.text.length = =0|| Self.pwdField.text.length = =0) {Ten One[Self ShowError:@"account number and password cannot be empty"]; A } - if([Self.accountField.text isequaltostring:@"123"] && [Self.pwdField.text isequaltostring:@"123"]) { - the //account password correct jump controller -Chaosmainviewcontroller *MAINVC =[[Chaosmainviewcontroller alloc] init]; -MainVC.view.backgroundColor = [Uicolor colorwithred: -/255.0Green -/255.0Blue -/255.0Alpha1.0]; - [self PRESENTVIEWCONTROLLER:MAINVC animated:yes completion:nil]; + -}Else { + A[Self ShowError:@"incorrect account or password"]; at } - -}
- Animation effect after unsuccessful sign-in
1- (void) ShowError: (NSString *) Error2 {3Dispatch_after (Dispatch_time (Dispatch_time_now, (int64_t) (1.0* nsec_per_sec)), Dispatch_get_main_queue (), ^{4 5Uialertcontroller *alert = [Uialertcontroller alertcontrollerwithtitle:@"Login Error"Message:error Preferredstyle:uialertcontrollerstylealert];6[Alert addaction:[uialertaction Actionwithtitle:@"Determine"Style:uialertactionstyledefault handler:^ (Uialertaction *_nonnull Action) {7 8 }]];9 Ten [self Presentviewcontroller:alert animated:yes completion:nil]; One ACakeyframeanimation *shakeanim = [cakeyframeanimation animationwithkeypath:@"transform.translation.x"]; -Shakeanim.values = @[@-Ten,@0,@Ten,@0]; -Shakeanim.repeatcount =9; theShakeanim.repeatduration =0.3; - //Animation - [Self.animView.layer Addanimation:shakeanim forkey:nil]; - + [Self.activeview stopanimating]; - +self.view.userInteractionEnabled =YES; A }); at -}
- Remembering passwords and Automatic login logic
ipad Development--qq Space Layout, login module