Custom table view cell in storyboard - uitableview

I have a pretty strange situation. I use storyboard in order to go with the times. And I have a view controller in which I have UIScrollView in which I have UITableView with with custom table view cells. So my question is: how to make a custom table view cell from storyboard inside scroll view, because before I used to make a separate nib with a Custom Cell in it. But now I get this error: 'The NIB data is invalid.' So please, suggest me any solution or idea how to solve my problem. Thank you in advance

I had the same problem. Turned out that I had checked "Use Autolayout" in the Interface Builder Document pane of the Storyboard file. This throws the "invalid NIB" error when running on iOS 5.

Related

Can I replace all xib with storyboard

I wonder if there is any way to replace all xib with storyboard. I am using a tableview which uses a custom cell. Usually all online resources and tutorials guide to make a xib and then load from delegate on a custom cell class. I dont want to use any xib in my project. How can I transfer those cell xib to storyboard and instantiate from there.
After some research and study I found that there is no such functionality in xib which cannot be replaced with storyboard. Thanks to #DonMag for comments and clue.
The only issue I was facing is to design uitableview cell, but prototype cell design can be used easily from storyboard. Here are some example how to use it.

Issue with Uicollectionview for nib but didn't get a UICollectionView

I am new for IOS development , and I try to use UIcollectionView to show the photo.
I create a xib file from New file -> iOS -> User Interface -> View , and add a Collection View like the following picture.
But I got the following error log when it crash.
Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: '-[UICollectionViewController loadView]
loaded the "AITLocalGridViewController" nib but didn't get a UICollectionView.'
And it seems didn't call viewDidLoad
I have search for some information , some information indicated that I dint not connect the collection view in xib file
But I don't understand what it mean.
Could some one help me and teach me what to do ?
Make sure that you have connected UIcollectionview IBOutlet with “collectionview “ that you declared in your program. And also you should make delegate&data source connection(For making this, click on th Uicollectionview in the xib. Select Connection Inspector. Where you can see delegate and datasource.By pressing ctrl button drag and connect it to File’s Owner.)
Just remove the view in Storyboard and use the UICollectionView as direct child.
Make sure UICollectionViewController's "view" outlet is set to a UICollectionView. Setting the "collectionView" to a UICollectionView is not enough for a UICollectionViewController.
At the risk of stating the obvious, also make sure that the UICollectionView is inside a UICollectionViewController. This can be overlooked when you do something like adding an embedded view into your project, where the default embedded view is the standard view controller.

Illegal configuration. Connection "cell" cannot have a prototype object as its destination

I have 2 errors
"Illegal configuration. Connection "cell" cannot have a prototype object as
its destination"
Connections dont duplicate, cells are empty, without other controls in them. I try to clean project and rebuild it, but it didnt help me. How can I fix it? Thank you
Are you trying to link outlets of the cells (or elements of the cells) directly to the view controller? That would be a problem.
If you want your table view to always have the same content, you can change its content to "static cells" in the storyboard, and then you can link it like that.
If you want the table view cells to change dynamically, you cannot do it that way. You need to create a UITableViewCell subclass for your cells, and create the outlets there.
If this doesn't help at all, please explain your problem a bit better.
You probably have an outlet from something like your view controller that's connected to a prototype cell in a table view. An outlet is a to-one relationship. The cell is going to be instantiated many times, so this doesn't make sense, and is an error.
The problem might be that the outlet from the ViewController was not connected to the desired object at all, although it might be connected from the desired object to the ViewController.
for example: the IBAction outlet can be seen from the UIButton's connection inspector for "touch up inside" as linked to the ViewController's IBAction method, but the ViewController's connection inspector will not link the IBAction method to the UIButton.
Same error when I copied/pasted the admob banner view from the official sample into my tableViewCell and connected the IBOutlet from viewController. So, Tiago Lira's explanation worked for me and I created the custom cell class and added banner iboutlet there. Thus the compile time error got resolved. The above question should be accepted.
The only reason for this error is that you have copied a storyboard item- It might be whole view controller or any sub element like the view, button, and label etc. So now the problem is that they have linked each other and now you have to find what is it and delete it.
But if you have copied the whole view controller and you have checked
all possible links you could but still you getting error then this
trick is for you- Copy the main view of that view controller and
delete that VC then a make new VC and paste the copied view in that
VC, so your constraints are safe you just have to give top, bottom,
left and right constraints for the main view.
I found a solution. I delete and add new cell many times, and finally project build without errors

Linking a "Table view Controller" in storyboard to load an .xib?

I am making a Table View Controller based iOS app with over 100 cells.
That would be hard to navigate in Storyboard, so is there a way I can link a Table View cell to open an .xib file and then have a "Back" button in the .xib file to link back to storyboard?
I made an empty application to use with storyboards, please help.
Nothing is stoppin you from loading the XIB in code manually. The event tableView:didSelectRowAtIndexPath: is still there.

Using NIBs in UIStoryboard

For an ipad application in ioS5.0 using arc and storyboard, i wanted to create another custom view and instantiate several instances of that view within a scrollview so as to show a scrollable train of these custom views. To do this, I created the custom view in XIB file, however, how should I instantiate this view in the ViewController being refrenced within the storyboard. The custom view also has a gesture recogniser within it.
thank you in advance for your help on this.
I don't think there is a way to instantiate a nib backed view from a storyboard. You can do most of the layout in your storyboard, but then you will have to programmatically build your nib backed views and add them to the scroll view.
As a side note, it sounds like you are building something that could be solved with a UITableView and a prototype cell. Here is a pretty good tutorial.

Resources