I'am developing IOS Universal App , and stuck in a logic and UI similar to Contacts App IOS 7, basically i have guests list and user can add guest , guest has many keys and doors.Just like contact in contacts app each one has multiple phone numbers , emails , etc I searched for tutorials and tried the following:
1.Create a UIView on add Action , make container for keys and another for doors along with 2 buttons "add key" and "add door", but the problem is i need them to be table view instead of moving the below controls of each new added key or door down.
2.tried the UITableViewController inside UIViewController,stuck because i had tow tables and each one has to have dynamic cells and it was a mess.
3.Now i came up with something close :
I made UITableViewController , Dynamic cells. 2 sections and initialised mutable array with 2 objects each is an mutable array one for keys and the other for doors.
Tow xib for add key and add door actions each contain a button with a segue to add key or door subview to the corresponding section and then reloadData.
Another Tow xib for key entry template and door entry template.
Is there another approach should i take or that's fine , if you have a tutorial or something please help it's taking time like forever and as you can notice i'am a newbie in ios.
I am having a hard time understanding your explanation, but if you're emulating the standard Contacts.app a single UITableView
will work fine.
Use your datasource to control what rows and sections should appear and where, I recently did this by having an array of section objects which simply have a name and fields array that contains field objects as the elements. The field object dictates which type of UITableViewCell
to display and what values they should contain. When I add/remove a phone number I update the data source and call the appropriate table view methods to animate the changes.
Here is a screenshot of the UI.
The data source for what is visible looks like the following....
NSArray
- Section (General Info)
- Fields
- First Name
- Last name
- Company
- Job Title
- Phone
- New Phone (special field that when tapped inserts another phone field)
- Email
- New Email (special field that when tapped inserts another email field)
- Section (Addresses)
- ...