No problem Matthew, I understand
It's actually really simple to use STV from a normal UITableView.
1- Create the detail view controller subclass as you would normally do for your root view controller. The detail view should have the table model defined in its header file, then initialized in viewDidLoad (you will probably not need to add any sections to the model at this point). All this is exactly what you do when you use STV in the RootViewController, there is nothing new here. The only difference is that you should create a @property to give access to the tableModel from outside the class, as you'll probably need that later (see below). For the sake of this discussion, I'll refer to this detail view controller as DetailViewController.
2- In the view controller that uses the normal UITableView, implement the UITableViewDelegate method called didSelectRowAtIndexPath to push the DetailViewController.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// I am assuming here that DetailViewController is a subclass of UITableViewController
DetailViewController *myDetailView = [[DetailViewController alloc] initWithStyle:UITableViewStyleGrouped];
// You'll probably need to add an SCObjectSection to the detail model
SCObjectSection *objectSection = [SCObjectSection sectionWithHeaderTitle:nil
withBoundObject:myObject withClassDefinition:myObjClassDef];
[myDetailView.tableModel addSection:objectSection];
// Push the detail view normally here (assuming self is within a UINavigationController)
[self.navigationController pushViewController:myDetailView animated:TRUE];
[myDetailView release];
}
That should be about it. Please tell me if you still have questions regarding this.
If the user taps the Add (+) button to add a new row, I only want them to be able to specify the First Name and Last Name in this Add view. Then, if they want to modify the Age and Phone number they must tap the newly created row to enter the detail edit view and do it through there. Is this possible?
The easiest way to do this is by implementing the SCTableViewModelDelegate method called detailViewWillAppearForSectionAtIndex and removing the automatically generated Age & Phone cells.
- (void)tableViewModel:(SCTableViewModel *)tableViewModel
detailViewWillAppearForSectionAtIndex:(NSUInteger)index
withDetailTableViewModel:(SCTableViewModel *)detailTableViewModel
{
SCObjectSection *objectSection = (SCObjectSection *)[detailTableViewModel sectionAtIndex:0];
// Assuming the cells order in the class definition is "First Name, Last Name, Age, Phone"
[objectSection removeCellAtIndex:3]; // Phone Cell
[objectSection removeCellAtIndex:2]; // Age Cell
}
Hope this helps!