HI @ll!
I want to add and remove some items to my datasource for my tableview programmatically.
First of all: What do I want to achieve? I habe a UIView with a TTTableView control (the Tableview from the Three20 project, but derived from the common UITableView control). This TableView is working well and has a TTSegmentedDataSource object attached as datasource. Currently the TableView is showing a UISwitch component. What I want to do is, to show and hide some items above the UISwitch control according to the state of the switch. And the elements should hide and show using the common TableView animations, just like the user has added or removed an item.
I already tried severeal aproaches to do so, but I don't get it.
For example:
[self.treeView beginUpdates];
[[((TTSegmentedDataSource*)self.treeView.datasource).items objectAtIndex:0] removeObject: objectToBeRemoved];
[self.treeView endUpdates];
[self.treeView reloadData];
This didn't work, and also throwed an exception.
What is the solution? How can I programmatically add and remove items from a TableView?
Hoping you can help me! THX!
C YA