I am trying to toggle a view on and off which works, but what i need to know is if I am abusing tags with this method. If so is there a better way?
- (IBAction) myButton:(UIButton*)sender {
if ([myLabelText.text isEqualToString:@""])
{
// do nothing
} else {
if ( sender.tag )
{
sender.tag = 0;
[[self firstView] setHidden:YES];
} else {
sender.tag = 1;
firstView.alpha = 100;
[[self firstView] setHidden:NO];
}
}
}
You can use the
tagproperty for anything you like, but in this case you can toggle the visibility without using it:Also, the valid range for
UIView‘salphaproperty is from 0.0 to 1.0. I’m not sure what you’re trying to do there.