Display NSImage in a NSTableView
Display NSImage in a NSTableView
- Subject: Display NSImage in a NSTableView
- From: Frederic JECKER <email@hidden>
- Date: Wed, 27 Jun 2007 17:11:14 +0200
Moin list,
I created a simple core data app (..my first one) that simply display
data in a NSTableView.
Now that it is working, i'd like to display a small icon in the selected
row when the user clicks on a button.
Below my code:
- (IBAction) activate:(id)sender{
NSBundle *thisBundle = [NSBundle bundleForClass:[self class]];
NSString *path=[thisBundle pathForResource:@"primaryKey" ofType:@"gif"];
NSLog(path);
int row=[table selectedRow];
NSArray *columns = [table tableColumns];
NSTableColumn *column=[columns objectAtIndex:0];
NSImage *image=[[NSImage alloc]init];
[image initByReferencingFile:path];
if([image isValid])NSLog(@"Image OK");
[[column dataCellForRow:row] setImage:image];
}
Note that table is defined as IBOutlet NSTableView *table;
The image seems to be correcly loaded but is not displayed in my table.
Anyone could help me with this problem ?
Thanks
--
Fred
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden