Quote:
Originally Posted by CommanderData
I think you were missing a bracket here and there (in case anyone else is playing along at home  )
Code:
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default" ofType:@"png"]];
|
I'm following along. Have tried this a couple different ways, but both present an error. The following gives me three "error: syntax error before ';' token" errors.
Code:
- (void)viewDidLoad {
imageArray = [[NSMutableArray alloc] init];
[imageArray addObject:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"rock" ofType:@"jpg"]];
[imageArray addObject:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"paper" ofType:@"jpg"]];
[imageArray addObject:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"scissors" ofType:@"jpg"]];
[super viewDidLoad];
}
Doing it the way below runs, but gives me three "warning: 'NSArray' may not respond to '-addObject:'" warnings.
Code:
- (void)viewDidLoad {
imageArray = [[NSMutableArray alloc] init];
[imageArray addObject:[UIImage imageNamed:@"rock.jpg"]];
[imageArray addObject:[UIImage imageNamed:@"paper.jpg"]];
[imageArray addObject:[UIImage imageNamed:@"scissors.jpg"]];
[super viewDidLoad];
}
If someone can tell me what I'm doing wrong, it would be appreciated. Thanks.
PS-I'm not building a Rock, Paper, Scissors application. It's just an example.