开发者

How to catch if an view or UITextField enters editing mode?

I've subclassed an开发者_运维问答 UITextField and inside that, I need to know if the text field is in editing mode or not. When editing mode changes from YES/NO I need to get notified somehow. I tried to overwrite the setter of the editing property, but that doesn't seem to work. Is there anything else?


You can get that event in textField's delegate using textFieldDidBeginEditing: method.

Alternatively you can add observer to listen for UITextFieldTextDidBeginEditingNotification notification.


We have a delegat method of textField that get calls autoatically when the textField enters into editing mode and while its exiting from editing mode

- (void)textFieldDidBeginEditing:(UITextField *)textField{
  EditingMode=YES;
}


- (void)textFieldDidEndEditing:(UITextField *)textField{
  EditingMode=NO;
}

hAPPY cODING...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜