Reputation: 449
I have 4 small "LED" icons which I use in my app to indicate the status of the objects in a UITableView and in a subsequent detail view. I don't really want to have to store them online - is there some way to save them as a part of the app? If so, how do I then reference them?
Upvotes: 1
Views: 245
Reputation: 22820
Just drag-and-drop them in your Xcode project.
Then, to "reference" them, you could just use :
[[NSBundle mainBundle] pathForResource:@"yourImage" ofType:@"png"];
To get the actual NSImage
(from your app bundle) :
NSString* imagePath = [[NSBundle mainBundle] pathForResource:@"yourImage" ofType:@"png"];
NSImage* image = [[NSImage alloc] initWithContentsOfFile: imagePath];
Upvotes: 2