开发者

IOS: UItextfield disabled

开发者 https://www.devze.com 2023-03-04 16:06 出处:网络
When we push on a textfield, a cursor appears in this tex开发者_如何学Ctfield, but I don\'t want that this cursor appear. I want to make this textfield disabled, where you can\'t write inside.

When we push on a textfield, a cursor appears in this tex开发者_如何学Ctfield, but I don't want that this cursor appear. I want to make this textfield disabled, where you can't write inside.

How can I do this?


Can you set enabled property/userInteractionEnabled of text field to No in ViewDidLoad() using the code

textField.enabled = NO;

or

textField.userInteractionEnabled = NO;


If you're working with storyboards or .nib files and you want it to start out disabled you can also easily uncheck the enabled property in interface builder for some time-saving.

0

精彩评论

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