Reputation: 11855
I have a customer view controller that is a subclass of UITableViewController. It has a list that lists all the customers. I have a + button in the top right. I want to make it so when people click the + it will go to the add customer screen and after you click save it will act JUST like the iphone contacts list and then display the newly added customer.
Would I need to create a controller for each view? One to display the list, one to add the person and one to view the contact then another to edit the contact? Or should I use one controller and just add a bunch of views in IB into the single view controller?
Upvotes: 0
Views: 266
Reputation: 946
I suggest you to use different views for every task because using one IB file uses more memory where as if you use different IBs and view controllers for every task then there is not too much memory is used and after completing one task for example when you save the user detail free the memory for that view so that you app do not use much memory.
Upvotes: 0
Reputation: 16725
I believe the way the Contacts app does it is:
To answer your question, I'd suggest using three different view controllers, just like the Contacts app.
Upvotes: 0
Reputation: 2062
CustomerListController
for seeing ALL customers.CustomerViewController
for viewing and editing the detail.CustomerViewController
calling it CustomerAddController
for creating, as this will need a little more functionality.Core Data Recipes application will give you some good pointers around this.
If you want it to only create the record after you hit save, you'll need to:
NSManagedObjectContext
, assuming you're using Core Data.CustomerAddController
class only (not needed for the view class).NSManagedObjectContext
classes in the CustomerListController
.Upvotes: 1