Re: Display NSImage in a NSTableView
Re: Display NSImage in a NSTableView
- Subject: Re: Display NSImage in a NSTableView
- From: "JECKER Frédéric" <email@hidden>
- Date: Wed, 27 Jun 2007 22:09:12 +0200
Found in cocoa's doc:
Discussion
If the receiver is not an image-type cell, the method converts it to
that type of cell.
On 6/27/07, Frederic JECKER <email@hidden> wrote:
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
_______________________________________________
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