a328189328
a328189328
2015-11-16 02:35

textfield未输入时done的禁用问题

  • ios

-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
NSString *newText = [textField.text stringByReplacingCharactersInRange:range withString:string];

if([newText length] >0){

self.doneBarButton.enabled = YES; }else{ self.doneBarButton.enabled = NO; }

return YES; } 为什么刚进入编辑界面时done还是能用,输入后再删光才禁用,刚进入时不也没字符吗

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答

为你推荐