I am working on an iPhone app, but i need to be able to add things to a UITableView... What is the easiest way to do this?
Techy
I am working on an iPhone app, but i need to be able to add things to a UITableView... What is the easiest way to do this?
Techy
If you're using a UITableViewController which is backed by an NSMutableArray (or NSArray), then the first thing you have to do is add the new object to your array with something like:
[objects addObject:obj];
Then call
[tableView reload]
which will cause tableView:numberOfRowsInSection:
to be checked.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [objects count];
}
Finally, tableView:cellForRowAtIndexPath:
will be invoked, which you have probably already written to handle rendering cells.