标签:
@property (strong, nonatomic) UITextField *iPhoneText;
@property (strong, nonatomic) UITextField *passwordText;
@property (strong, nonatomic) UIButton *passwordBtn;
viewdidLoad 中设置文本框的监听变化的方法
[self.iPhoneText addTarget:self action:@selector(textChange) forControlEvents: UIControlEventEditingChanged];
[self.passwordText addTarget:self action:@selector(textChange) forControlEvents:UIControlEventEditingChanged];
[self textChange];
///根据判断 text1与 text2是否有值
-(void)textChange{
self.loginBtn.enabled = self.iPhoneText.text.length && self.passwordText.text.length;
[self.loginBtn setBackgroundColor:LoginButtonColor];
}
标签:
原文地址:http://www.cnblogs.com/aiyiran/p/5030641.html