0

I have NSTableView with 3 tabs. Now, I want an image inside every tab, how can i do ? I must use NSImage with position, so ?

NSImage *theImage; theImage = [NSImage imageNamed@"myImage.png"];

rmaddy
  • 314,917
  • 42
  • 532
  • 579

1 Answers1

0

you can do like this: in code create one NSMutableArray with property and synthesize

header file:

@property (readwrite, retain) NSMutableArray *imageArray

implementation file:

@synthesize imageArray

do like this wherever you want to add image to array:

NSMutableDictionary *imageDict = [NSMutableDictionary dictionary];

    [imageDict setObject:[NSImage imageNamed:@"ABC"] forKey:@"image1"];

    [imageDict setObject:[NSImage imageNamed:@"XYZ"] forKey:@"image2"];

    [imageDict setObject:[NSImage imageNamed:@"XYZ"] forKey:@"image3"];

    [imageArray imageDict];

    [self setImageArray:imageArray];

take array controller in XIb, bind arraycontroller to imageArray array, bind table column with the array controller with given key path (here keypath is image1,image2 and image3).

one More thing take image name without extension . drag and drop image cell on tableview cell

PR Singh
  • 653
  • 5
  • 15