How to edit cells on UITableView using XIB, just like Storyboard - ios

I'm running on some glitch or may be functionality lack.
I cannot edit UITableView when using XIB, just like Storyboard does.
There is something i'm missing??

Apple does not allow being able to edit cells directly in an XIB. You have to create a separate XIB for the cell and in the table view data source return a cell with that cell subclass

Maximillian is right — so instead of designing your cells in a XIB, I would design it in a storyboard, which then you could link into a larger storyboard with RBStoryboard.

Related

Not able to add footerView in UTableView through XIB

I am trying to add FooterView(UIView) by dragging down on UITableview through XIB but can't.
Yes we can add it programetically (tableView.tableFooterView = myView) & also works with dragging view in Storyboard,
But I want right from XIB.
You cannot do this in a Xib. If you think about it, a storyboard is somewhat like a collection of Xib files. Thus, in a storyboard you can add a footer view as a kind of 'xib' embedded in that storyboard. A pure xib cannot contain multiple child xib's, so what you want is not possible unfortunately.

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

UITableViewCell is not available in XIB file in XCode 5

I have just encountered a problem today that I am unable to add a new table view cell to my UITableview.
What I did was I drag a table view cell and drop inside the UITableview area. The UITableview did not take the table view cell but rather the cell become an individual view of the main view.
Clearly see that table view cell is not included in Table View
So my question is, how to create a custom table view cell in UITableview in an XIB file in Xcode 5?
Thanks in advance!
If you have dynamic prototype cell will be added automatically. If not, you can choose how much cell you want to have in inspector on right side of screen.
And make sure when you put it into screen that is inside of your tableview.
I answer this question thinking you are using storyboard. First add UITableView.
Then you can see as this,
If you want to use static cell, select Table View & in Attributes Inspector , in content select Static Cells. I think for your question you should use Static Cells.

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