开发者

why does the uitextfield never return nil when it becomes first responder?

开发者 https://www.devze.com 2022-12-10 21:04 出处:网络
when i make my textfield become first responder, the text field never returns 开发者_如何学Pythonnil, even if i force it to be nil by myTextField.text = nil;

when i make my textfield become first responder, the text field never returns 开发者_如何学Pythonnil, even if i force it to be nil by myTextField.text = nil; as soon as i comment out the "[myTextField becomeFirstResponder];" the text field is able to return nil. anybody have any idea why?


Becoming first responder initializes the internal NSString that holds the text you type to an empty string: @"", thus no longer nil. Being firstResponder is a persistent action, in order to always have a valid NSString in there when the user begins to type.

0

精彩评论

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