开发者

Updating NSTableView after adding an item to array

I have a tableview whose columns are bound to an array controller. I'm programmatically adding items to the array:

Person is just a custom class;

personsPresent is in another class called Meeting, it's a MutableArray which contains Person objects.

Person *newPerson = [[Person alloc]init];
[[[self meeting] personsPresent] addObject:newPerson];
[[self tableView] reloadData];

This works, but the values don't show up into my table view until I sort the columns. I thought reloadData would do it for me.

In my xib, my nsarraycontroller's objectcotnroller settings is set to Class and Person. It's controller content it's bound to File Owner and it's model key path is开发者_运维技巧 meeting.personsPresent.

Any help would be appreciated.

Mark


You're mutating the array behind the array controller's back. Either ask the array controller to -rearrangeObjects (stinky) or use its -addObject: method (better).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜