2011-08-15 11 views

Respuesta

2

Se utilizan [abc setEnabled:NO] para no permitir al usuario editar, o setHidden para ocultar por completo

+0

¡Muchas gracias! – Shawn

3
[textField setHidden:YES]; 
[textField setHidden:NO]; 

Si está oculto, el usuario no puede interactuar con él o verlo.

12

Si desea ocultar por completo:

abc.hidden = YES; 

Si lo que desea es evitar la interacción con el usuario:

abc.userInteractionEnabled = NO; 

Dado que UITextField es una subclase de UIView (y UIControl), todos los métodos UIView (y UIControl) (como los que utilicé anteriormente) están disponibles.

3

Puede hacerlo de varias formas.

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 
Cuestiones relacionadas