That works great for editing, but it does not work for my add item screen because I am not using an ArrayOfObjects section but only one SCObjectSection.
Here is my code that could work, but I have a modalViewController in progress from an imagePicker, so this code crashes:
UINavigationController *detailNavController = [[UINavigationController alloc] initWithRootViewController:detailViewController];
[self presentModalViewController:detailNavController animated:TRUE];
Here is all of it.
- (void) loadNewObjectTable{
SCNavigationBarType navBarType;
if(self.navigationController)
navBarType = SCNavigationBarTypeNone;
else
navBarType = SCNavigationBarTypeDoneRightCancelLeft;
SCTableViewController *detailViewController = [[SCTableViewController alloc] initWithStyle:UITableViewStyleGrouped withNavigationBarType:navBarType];
detailViewController.delegate = self;
SCClassDefinition *shoeClassDef = [SCClassDefinition definitionWithClass:[Shoe class]
withPropertyNames:[mainDelegate attributeNamesArray]];
[self setupClassWithDefinition:shoeClassDef];
SCObjectSection *objSection = [SCObjectSection sectionWithHeaderTitle:nil withBoundObject:currentShoe withClassDefinition:shoeClassDef];
[detailViewController.tableViewModel addSection:objSection];
if(self.navigationController)
{
[self.navigationController pushViewController:detailViewController animated:TRUE];
}
else
{
// Create the navigation controller
UINavigationController *detailNavController = [[UINavigationController alloc] initWithRootViewController:detailViewController];
[self presentModalViewController:detailNavController animated:TRUE];
}
[detailViewController release];
}