Drag UITableCell onto UITableView - ios

I'm fairly new to iOS development and want to create a simple form using a grouped UITableView with UITabelCells to lay-out the form's contents. I want to do this interactively in XCode5.
My problem is, having added a UITableView to the xib, I can't edit its contents in XView. I had anticipated being able to drag UITableCells onto it. Is this possible in XVIew, or do I have to create the table's contents programatically?

You cannot directly edit tableViewCells inside the TableView using xibs. It sounds like you want to use what are called prototype cells. These can only be created using storyboards. Here's a tutorial for prototype cells:
http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1

From iOS 5 and above Storyboard are being primarily used to design the app interface rather than xib.
With your view controller opened in storyboard you can define how the cells looks like for the tableview ( prototype or static content based)
Here is one example
You can read more on it in the docs
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/TableViewCells/TableViewCells.html

Related

Static table cells with detail

I'm trying to make an iOS 'information' or 'guide' app in Swift. I wanted to utilise the Master Detail template so that when the user clicks a cell it will take them to a relevant ViewController with either basic text labels or a PDF file.
From what I understand, Dynamic Cells can be dynamically changed whilst the app runs however I want to set static cells from the storyboard (or programmatically) and their relevant content/PDF files so the user can view each one. I don't want any "new cell" or "editing" functionality.
How can I make this work? I would post my code so far but it's almost identical to the Master Detail template so I don't see any use. I know this is quite a vague question but I need help and don't know where to start.
Any help will be so appreciated!
A static table cell can entirely be created via storyboard. In the storyboard once you add a tableviewcpntroller you can prototype call added to it.You can add as many prototype cells to your table ( not necessarily every one should have common layout). After all cells are added you can assign individual tags to the cells if you need identify these cells from your code.You can add segue from each cells to move to different page.
Let me know if something more is needed.
In Interface Builder set the Content of the table view to Static Cells.
Drag as many table view cells as you need into the table view.
In the controller create IBOutlets for the labels and the other UI elements.
Connect the outlets in Interface Builder.
Rather than using the datasource methods assign the values directly to the UI elements via the outlets.

Table View not showing up as expected

I'm pretty new to Xcode and I'm learning. I'm trying to make a test app. I can't get it to show up in the app like I set it in my storyboard?
Add a UITableViewController and assign it to your tableView. And FYI in Xcode you design one cell only if you are using dynamic cells and the population of the cells will all happen inside your UITableViewController (hence the name PrototypeCell)

Custom UITableViewCell using storyboard with some cells

I have a TableView in which a most cells are pretty standard. I make them buy using static cells in Storyboard. However, one cell I would like to customize probably using an XIB file so I would need to load it programmatically.
In the TableView's data source, is it possible to handle loading XIB view for this particular cell only, while leaving other cells to what's delineated in the static cells in the Storyboard? Or is it an all or nothing thing where I need to just give up using static cells altogether?
The rationality for doing this is that I would like to make Storyboard to look as close to the real thing as possible. Right now if I provide a data source, the static cells in the storyboard would have no effect on the actual output and is not in any sense linked to the actual output.
Yes, it is possible. Set the custom class for the custom cell. If you wish to customise it from code, just connect it as an IBOutlet to the UITableViewController.

how do I set up a table view in interface builder for a 'settings' type interface

So I guess the table view has been designed around the idea of using dynamic data received at run time, but I want to make a settings type app where all of the cell values are known as I build it, so I was hoping to be able to set the section / row configuration, labels ect, as well as the properties for each cell (whether it has other views inside it like a switch, or whether it is a button etc) all in interface builder.
can I do that? how?
I am using xcode 4.4.1
To use static cell content you have to make sure that you are adding a UITableViewController not just a UITableView dragged into a UIViewController. The latter requires dynamic prototypes.
Once you've added the table view controller to your storyboard it is as simple as selecting "static cells" in the attributes inspector. From there you can drag and drop UITableViewCells and modify them as you wish.

What is the alternative to static style cells in storyboard?

I cannot use static style UITableViewCells because of the storyboard restriction that the underlying controller must be a UITableViewController.
So how can I achieve the UI layout like the 'new contact' screen in the ios Contacts app?
In particular the phone numbers/email ('mobile', home) input: is there any existing API that draws the thin vertical divider? Or I have to create a nib?
I've seen this done by having the top three fields be fake. Use a table view header which has the image view and the First/Last/Company be simple textfields. You put a pretty picture that looks like table cells behind First/Last/Company.

Resources