Reputation: 699
In the app I'm designing, here is what I'm trying to achieve:
A main view, which only have 3 items, "to-do", "shopping list", "note".
A detail view, based on the item selected in the main view, display different set of data. This is a UITableView.
My questions are:
An example or a link is much appreciated.
UPDATE:
I plan to use NSUserDefault for storing the data, since to-do list and shopping list are relatively very light weight. In the future, if needed, I'll consider using firebase
or iCloud
for backup and syncing purpose.
Upvotes: 1
Views: 148
Reputation: 1865
Question 1: As Gabe said, you could do either, but it's probably simpiler to just use three buttons.
Question 2: The best way to handle view controllers displaying different data is to have different view controllers. Use one view controller for each category you have. Use a navigation controller to create the transitions between view controllers. From the buttons to the detail views, create show
segues. Consider a storyboard set up like this:
Upvotes: 1
Reputation: 590
Question 1: You could do either, but it would be easier to just make a UIView
with 3 buttons.
Question 2: The best way to accomplish this is with the present segue
. Make 3 UITableViewController
to be your detail views for the 3 buttons in the main view. Then drag from each button to its respective tableViewController
and select present
. Give each segue
an identity. Then, in your main view, in prepareForSegue
, make three if statements
checking for if the segue.identifier == "buttonSegueIdentifier"
. In each if statements, perform the necessary tasks. Finally, when each button is clicked, call prepareForSegue
.
Upvotes: 1