How to disable and hide UITextField

Hi, I am new to iPhone development, how to disable UITextField in iPhone? If that matters, this is a View-based application, and the UITextField is called abc.

thanks

+6
source share
4 answers

You use [abc setEnabled:NO] to prevent the user from editing it, or setHidden to completely hide it

+2
source

If you want to hide it completely:

 abc.hidden = YES; 

If you just want to prevent user interaction:

 abc.userInteractionEnabled = NO; 

Since UITextField is a subclass of UIView (and UIControl), all methods of UIView (and UIControl) (for example, those that I used above) are available.

+12
source
 [textField setHidden:YES]; [textField setHidden:NO]; 

If it is hidden, the user cannot interact with it or see it.

+3
source

You can do this in several ways.

 abc.alpha = 0; //text field is there, just transparent, so it can't be seen. abc.hidden = TRUE; // textfield is hidden, not on View at all. abc.userInteractionEnabled = FALSE; // user can see the text field and any text // that has already been set but cannot edit 
+3
source

Source: https://habr.com/ru/post/895096/


All Articles