首页 > 其他 > 详细

动态实时监听文本框中内容的变化

时间:2015-12-08 19:58:00      阅读:145      评论:0      收藏:0      [点我收藏+]

@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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!