按住ctrl键就开始拖
1 // 2 // VCRoot.m 3 // XIBAPP 4 // 5 // Created by wky on 29/09/2017. 6 // Copyright © 2017 wky. All rights reserved. 7 // 8 9 #import "VCRoot.h" 10 11 @interface VCRoot () 12 13 @end 14 15 @implementation VCRoot 16 17 - (void)viewDidLoad { 18 [super viewDidLoad]; 19 // Do any additional setup after loading the view from its nib. 20 } 21 22 - (void)didReceiveMemoryWarning { 23 [super didReceiveMemoryWarning]; 24 // Dispose of any resources that can be recreated. 25 } 26 27 /* 28 #pragma mark - Navigation 29 30 // In a storyboard-based application, you will often want to do a little preparation before navigation 31 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 32 // Get the new view controller using [segue destinationViewController]. 33 // Pass the selected object to the new view controller. 34 } 35 */ 36 37 - (IBAction)pressLogin:(UIButton *)sender { 38 NSString* uName = @"Mike"; 39 NSString* uPwd = @"123"; 40 41 if( [_mTFUsername.text isEqual:uName] && [_mTFPassword.text isEqual:uPwd] ) 42 { 43 UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"登录成功" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:@"朕知道了", nil]; 44 45 [alert show]; 46 47 } 48 else 49 { 50 UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"用户名或密码不正确" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:@"朕知道了", nil]; 51 52 [alert show]; 53 54 } 55 56 57 } 58 -(void) touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event 59 { 60 [_mTFUsername resignFirstResponder]; 61 [_mTFPassword resignFirstResponder]; 62 } 63 64 65 66 - (IBAction)pressReg:(UIButton *)sender { 67 } 68 @end