- (void)loadView
{
[super loadView];
arrayOfImages = [[NSMutableArray alloc]initWithObjects:@"11.jpg",@"22.jpg",@"33.jpg", nil];
UIImageView *awesomeView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
[awesomeView setImage :[UIImage imageNamed:[arrayOfImages objectAtIndex:0]]];
awesomeView.contentMode = UIViewContentModeScaleAspectFit;
[self.view addSubview:awesomeView];
NSLog(@"%@",[arrayOfImages objectAtIndex:0]);
}
When I put the NSMutableArray
in -(void)viewDidLoad
, UIImageView
displays nothing and NSLog
shows NULL. Why is that?
ps. NSMutableArray worked perfectly in -(void)loadView
. I've declared NSMutableArray *arrayOfImage in @interface .h file