Hide and show buttons or textfields


/ Published in: Objective C
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.