Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 03-18-2009, 03:51 PM   #17 (permalink)
DenVog
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 500
Default

Quote:
Originally Posted by CommanderData View Post
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.
DenVog is offline   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,282
Threads: 39,072
Posts: 171,339
Top Poster: smasher (2,575)
Welcome to our newest member, FANFAN
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:48 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.