Reputation: 7377
How do I get a button with the a specifyed tag
id like to then cast it to a UIButton, and change the alpha
Upvotes: 1
Views: 3133
Reputation: 2048
UIButton *button=(UIButton *)[self.view viewWithTag:tag];
button.alpha=0.5;
Upvotes: 6
Reputation: 523184
UIView* view = [theViewContainingThatButton viewWithTag:tag];
view.alpha = 0.5;
You don't need to cast the view to a UIButton to change its alpha. But you can add a (UIButton*)
cast if really needed.
Upvotes: 1