开发者

How to make text field first responder and not delete text? iPhone

开发者 https://www.devze.com 2022-12-29 03:56 出处:网络
When I make a text field first responder it deletes my default text.I want this text to stay until the user enters something.

When I make a text field first responder it deletes my default text. I want this text to stay until the user enters something.

The end result that I am looking for is that I want the keyboard to appear on the screen and default instructions to still appear until user clicks a button on the keyboard... at which time it should clear de开发者_开发百科fault text.

I tried making the textfield first responder when the view loads... this allows me to show the keyboard... but it clears out my instructional text.


In interface builder remove the checked for the "clear when editing begins" and in the textFieldDidBeginEditing method

- (void)textFieldDidBeginEditing:(UITextField *)textField
{

[textField1 clearsOnBeginEditing];//textField1 is the instance of your text field.

}

All the Best.

0

精彩评论

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