I'm still exploring xCode/Objective-C, And I was wondering how would I be able to change the alpha of a UIImage. I tried writing my own code but I get the error 'Property 'alpha' not found on object of type UIImage'. The splash screen works if I comment out the alpha changing lines. My code is below.
//
// ViewController.m
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic,weak) IBOutlet UIImage *logo;
@end
@implementation ViewController
ADBannerView *_bannerView;
- (void)viewDidLoad
{
[super viewDidLoad];
[self.view addSubview:_bannerView];
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(showLogo:) userInfo:nil repeats:NO];
}
- (void)showLogo:(NSTimer *) timer{
[UIView animateWithDuration:2.0 animations:^{
self.logo.alpha = 1.0;
} completion:^(BOOL finished){
[UIView animateWithDuration:2.0 animations:^{
self.logo.alpha = 0.0;
} completion:^(BOOL finished){
ViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"Menu"];
[self.navigationController pushViewController:controller animated:YES];
}];
}];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
//Thank You!
You need to change the alpha of the UIImageView
it is contained in, there is no alpha property for UIImage
.