Posted By

Develomentional on 09/05/12


Tagged

show hide hidden UIButton bool UITextField


Versions (?)

Hide and show buttons or textfields


 / Published in: Objective C
 

Shows how to make a text field or UIButton visible or hidden in a method by passing a bool in you can make it hide or show the object just change states if its hidden it would show or if visible it would become hidden but I like to control that so it does what I want when I want.

  1. -(void)hideShow:(BOOL)YN{
  2. Switch(YN)
  3. Case 0:
  4.  
  5. Self.button.layer.hidden = YES;
  6.  
  7. break;
  8.  
  9. Case 1:
  10.  
  11. Self.button.layer.hidden = NO;
  12.  
  13. break;
  14. }
  15. //usage:
  16.  
  17. [self hideShow:YES];//button is visible
  18.  
  19. [self hideShow:NO];//button is hidden
  20.  
  21. //text field outlets will work too like this
  22. Self.myTextFieldOutlet.hidden =YES;

Report this snippet  

You need to login to post a comment.