Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using static cells in a storyboard UIView with Xcode 4.2

I am attempting to create a very basic login screen, using the Storyboard designer in Xcode 4.2. I'd like a grouped table view to contain the login and password fields. There are some other elements on the view, such as a login button, a forgot password link, etc. Additionally, the background should be able to be tapped to dismiss the keyboard, when a input field has focus.

Pre-Xcode 4.2, I accomplished this with a UIView that implemented the UITableViewDataSource protocol, generated and returned cells, etc.

In Xcode 4.2, this all feels very close to be able to be done visually, with the static cell option, but you are not allowed to use static cells unless the table is part of a UITableViewController (or subclass). I don't see a way to layout the elements that I need in this scene with a TableViewController, so I'm wondering if there's a better approach here.

Here's the mocked up layout I'm going for:

mockup

Is there a way to accomplish this use case with the storyboard designer?

like image 283
Jason Vasquez Avatar asked Nov 04 '22 12:11

Jason Vasquez


1 Answers

1) If your view controller is not an instance of UITableViewController, this is not possible.

According to Apple's documentation (https://developer.apple.com/library/ios/#releasenotes/Miscellaneous/RN-AdoptingStoryboards/_index.html#//apple_ref/doc/uid/TP40011297):

For a table view that is the view of a UITableViewController instance, you can configure static content directly in the storyboard.

2) But UITableViewController has many limitations which prevents you to use it in many scenarios:

http://www.skylarcantu.com/blog/2009/09/24/dont-use-uitableviewcontroller-really/

Conclusion: it essentially makes the static cells in storyboard not feasible in most cases.

like image 190
nybon Avatar answered Nov 15 '22 05:11

nybon