I have developed an iPhone app which I am trying to port to iPad using UISplitViewController. The iPhone app is an ideal candidate for "Master-detail view" design. The master view shows a list of things and clicking on each row opens up its detail in the detail view. However, my problem is that I need the detail view to contain a static table containing 5 cells. I am unable to figure out how to put a static table in the detail view of the UISplitViewController. I tried the following:
As soon as I change the cells to static, I get an error "Static table views are only valid when embedded in UITableViewController instances".
I am unable to understand what this error means and how to configure static cells in detail view. What should I do?
I am relatively new to iOS programming and have been struggling for past 2 days on this problem.
The error means that in order to use static cells, you have to have a UITableViewController
. It is not enough to use a UIViewController
and add a UITableView
to it. What I would do is to add a container view
to my detail, and embed a UITableViewController
in it (ctrl+drag - embed segue), that way the UITableViewController
becomes childViewController
of your detail VC and you can change it when you tap a different cell in the master.
If you don't want to change it, then just delete the detail
part suggested by the storyboard, and add an instance of UITableViewController
.
Edit:
Here is my setup that I just tried, and it works. The right most screen in the picture is a subclass of UITableViewController
. When you add a Container view
to your detail, it adds a UIViewController
automatically. Delete that and add a UITableViewController
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.