Custom static table cells in XCode storyboard? - ios

We are trying to teach our designer to create simple iOS apps using storyboards.
One thing we can't figure out though is a straightforward way to have custom static table cells.
Static in the sense that he can add static info to the cells in storyboards (not loaded from a database or anything).
The problem we're having is we can't work out how to make a custom cell with a custom layout.
We can create a custom layout programatically. However, in the storyboard bit doesn't show up the layout (it shows the layout of a standard table cell). So we can't fill in the extra labels and images and such.
Can we make a custom cell so that it will show up in storyboard and let us make static cells out of it?
Thanks

There is a property when you select the table view in the storyboard and you have to change it from Dynamic to Static and then you add the extra labels and images there.

Related

Should I select Statics cells or Dynamic Prototype

hello I want to implement a table like this
first,I don't know what this table is using.
should I use static cells and sections or should I use dynamic Prototype with the style Grouped?
I am confused as I am new and don't know much difference in static cell and dynamic cell.
I want to ask How can I set left and right margins around tableView like this image?
Then you can Use Dynamic table View setting with custom TableView Cells. The process to setting the Custom Cells. you can follow the steps from here .
http://www.appcoda.com/customize-table-view-cells-for-uitableview/

Text not appearing in tableview controller

I have a tableview controller as my initial view. I added some text into it and it's not appearing. First i added some labels, and none of them was appearing, i thought maybe it was a constraint problem. So i added constraints and still didn't work. Then I made the cells basic rather then custom. In basic, it gives you text for you. And still the text isn't appearing. How can i fix this?
Note: This is a new project, I have tested this on a real device and have the same issue.
The table is created with the default prototypes of cells (Content field is Dynamics Prototypes) that need to create and add from the code. If you want to make a static cell, you need to do this in storyboard:
Select TableView
Set Content field in Attributes Inspector to Static Cells
Add your labels to Static cells

Why there is no prototypeCell in View.xib?

When we add any UITableView to UIViewController through storyboard we will see screen like this
and there is an option for PrototypeCell top right side. But when we add the UITableView to View.xib we will see screen like this
and here there is no PrototypeCell. I am not understanding this why there is difference. Please explain.
It's different because when you drag and drop a UItbaleViewController in the UIStoryboard, it assume that you will use dynamic cells, and when you drag and dropped a simple UITableView it changed the property to static, which means that you will provide different UI and informations to each cells.
You can change the style to dynamic instead of plain if you want to have prototype cells.
PrototypeCell not available in xib file, storyboard only.
You can use separated xib for UITableViewCell in this case. (in storyboard case you also can use separated xib for cells)

Use the same cell type in different screens in storyboard without duplication

I have a UITableViewController using many different types of cells.
In the code, each of those cells has its own UITableViewCell subclass.
In storyboard, they are all in the same screen.
Now I need to use the same cells in other screens as well.
How do I do that without having to copy and paste my cell in storyboard in the new screens?
I don't want any duplication in storyboard when it comes to layout and constraints.
Your best option is probably to move the cells into separate XIB files. You need to use the registerNib: method on UITableView to tell the table where it can find the cell definition.
You can create a
UITableViewCell
class.
Use this class as the cell's custom class and Ctrl link your cell's items to the property in this class.
Then you can use this cell class for other table views

UISegmentedControl with UITableView

I have the following views set up in IB for my project: UITabBarView->UINavigationView->MyCustomViewController.
I added a UISegmentedControl and a UITableView to the CustomView via IB by just dragging them onto the screen. I would like my app to look very similar to the AppStore app. Everything looks fine in IB; however, once it populates the UITableView with data, it covers the whole underlying view with a single cell (the segmented control is covered).
I didn't want to have to do everything in code so I've tried to stick with IB since this seems simple enough. Does anyone know why my UITableView is taking up the whole frame?
I figured out what was going on. I was incorrectly re-sizing the table view cell when binding the data. I ended up using the new prototype cells in the storyboard instead of trying to create a separate nib.

Resources