I have been at this for a few days now and cant figure this out.
So, say I have an array:
Item # | Name | Price | Discount
1 | Car | 3000 | 15%
2 | Bus | 6000 | 5%
3 | .... | 4500 | 0
Also I have a table view where I want items to show like the scheme above, but instead what i get is:
1 | 1
Car | Car
Bus | Bus
.... | ...
So the tableview actually repeats only the first row of the Array and prints its contents repeatedly for each consecutive column.
I am just beginning to code so would be nice to hear some advice. The tableView is linked to sourceData, and made Outlet.
I have the following overrides:
-(NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
{
return [self.allData count];
}
-(id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
return [self.allData objectAtIndex:row];
}
-(void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
[self.allData replaceObjectAtIndex:row withObject:object];
[self updateChangeCount:NSChangeDone];
}
What am I missing?