I am using NSTableView
to display my data. I have to change table data by clicking some buttons. So number of rows are not fix. Sometime it use only 2 rows and sometimes 12.
What i want is my tableview height can be resize according to number of rows or cell used.
I tried this but its not working with me.. Infect i can't even see my table by using that code. I am usingNSWindowController
.
EDIT :
- (void)addImageToTableView
{
[tableView setBackgroundColor:[NSColor clearColor]];
[tableView setHeaderView:nil];
if([title isEqualToString:@"First"]){
if (开发者_Python百科[[arrayController arrangedObjects] count] != 0)
{
[arrayController removeObjectsAtArrangedObjectIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [[arrayController arrangedObjects ] count])]];
}
[arrayController addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSImage imageNamed:@"MS.png"],@"image", nil]];
[arrayController addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSImage imageNamed:@"CVS.png"],@"image", nil]];
}
if ([title isEqualToString:@"Second"]) {
if ([[arrayController arrangedObjects] count] != 0)
{
[arrayController removeObjectsAtArrangedObjectIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [[arrayController arrangedObjects ] count])]];
}
[arrayController addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSImage imageNamed:@"NS.png"],@"image", nil]];
[arrayController addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSImage imageNamed:@"EM.png"],@"image", nil]] ;
[arrayController addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSImage imageNamed:@"RES.png"],@"image", nil]];
[arrayController addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSImage imageNamed:@"ERS.png"],@"image", nil]] ;
[arrayController addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSImage imageNamed:@"RS.png"],@"image", nil]];
[arrayController addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSImage imageNamed:@"FB.png"],@"image", nil]] ;
[arrayController addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSImage imageNamed:@"SKIN.png"],@"image", nil]];
}
[tableView reloadData];
[self windowDidLoad];
}
-(void)windowDidLoad{
[super windowDidLoad];
}
Any other suggestion??
Thanks in advance..!!
精彩评论