I'm trying to change the alpha
of an UIButton
from another class. The function that is called in set the alpha
property of my UIButton is actually called because I've put a NSLog
there and I can see how it works. I'd be thankful if you could give me any suggestion.
Here's my current code.
ViewController.h
- (void) setAlphaToButton;
@property (strong, nonatomic) IBOutlet UIButton *myButton;
ViewController.m
@synthesize myButton;
- (void) setAlphaToButton {
myButton.alpha = 0.5;
NSLog(@"Alpha set");
}
ImageViewSubclass.m
- (void) tapDetected:(UITapGestureRecognizer *)tapRecognizer {
ViewController *VC = [[ViewController alloc] init];
[VC setAlphaToButton];
}
And when the image view is pressed, in my console I get: Alpha set
. And the button doesn't change.