Xib to Storyboard issue in copying - ios

I recently migrated from Xibs to Storyboard in Xcode 6. To do this, I created a new controller in storyboard, deleted the view in storyboard, selected and copied the whole view hierarchy in controller's xib and pasted it to storyboard.
I had to manually remap outlets in storyboard and it works.
The problem is I can not see any of the views in the storyboard, and so can not add any new subviews. All I see is the name of the controller and thats it (see image).
How do I get around with it ?

Related

Load xib from Cocoapod in Storyboard

I have a storyboard where I want to embed a viewcontroller in a containerview. The ViewController and its xib are in a cocoapod I made. Is it possible to embed a viewcontroller and its xib from a cocoapod in a storyboard containerview?
I know that if you delete the viewcontroller's view (in the storyboard) then the storyboard will try to load the xib with the same name as the viewcontroller. However, this isn't working. The app crashes when the viewcontroller's outlets aren't linked up. I can only assume it's because the xib is in my cocoapod.
I've checked that the names match and all the appropriate custom types are set in IB (like changing File's Owner from UIViewController to MyCustomViewController). I added the xib to "resource_bundles" in the podspec too.

IOS Custom UIView doesn't show

I'm sorry but i'm still a bit dumb in UIViews and creating a custom one.
I have a custom view and a xib file that are connected through the XIB IB.
I want to add this view to the storyboard.
What you see in this picture is an empty view which i've connected to the custom view class
When launching the app - i see the exact same view without my custom view being loaded.. what am i missing ?
It is not enough to just link your xib view to the storyboard through the view class name. You should copy the view from your xib (open your xib, select the root view and copy) to your storyboard view controller (select the parent view and paste). You can even open (double tap the xib file in the navigator) your xib in a new window and do a drag drop to the story board. Note that all the property wirings and constrains that you had defined in the xib will be retained when you copy paste your view from xib file.
The answer is actually pretty simple.
I had a recursive init process - meaning that although i did over initWithCoder method, in the xib file, i've set the view class to be my class.
What i should have done is to make my xib file's owner to be my class instead.
And then all the loadFromNibName worked perfectly in my initWithCoder!

Copy and paste storyboard controller into xib file. Supported or not?

I want to refactor out a storyboard controller to a separate xib, for better reusablity.
The controller extends UITableViewController.
I can select the controller in the storyboard, hit Cmd-C, create an empty xib file using the New File wizard, and finally paste the controller into the xib.
It seems to work ok. The UI elements are there, the outlets are there, etc. It forgets the orientation and the size (portrait, Retina 4-inch), but I can easily set that in the properties pane to the right in xcode.
However when trying to use this xib I get a crash with error message:
loaded the "MyController" nib but the view outlet was not set.
When I try to connect Files Owner to the table view (which is the top view in a controller extended from UITableViewController), xcode won't let me connect them.
My question: Is it unsupported to copy-paste a controller from a storyboard to a xib?
You are most likely jamming a tableViewController into a nib and there is no outlet to hook the view to. When you do Ctl-C in the storyboard make sure you copy the UITable not the UITableViewController. If not you can try to manually create the outlet in the controller but you might have to jump through hoops to make it work.

Create storyboards that use XIB files

I'm creating an app which includes a lot of re-usable views.
For this to work I created my main storyboard, and then the xib files for the re-usable views.
I then figured out a way to 'extract' the view from the xib file (drag the view out of the controller) which gave me the ability to freely resize the view in the xib file.
The outcome was that I had a bunch of custom sized views (xib's) and my main storyboard which would dynamically build lists from the xib files to use as sub views on it's main view.
Everything works perfectly in the simulator, but my question is, is it 'legal' to do it this way. Or would apple reject the app?
Thanks
Its ok to do so,Infact you can created custom sized views in storyboard itself but they will be embedded in viewcontroller anyway
Make the size to freeform in the attribute inspector of viewcontroller and you can have the customised sized view in viewcontroller itself

UIContainerViews storyboard

I have a normal UIViewController in my iPad storyboard. inside this viewcontroller I have other 2 UIcontainerViews, each linked up with another UIviewController (when I added the containerView, Xcode automatically created these 2 view controllers). I now have 2 view controller in the same view controller each wired up to a different class.
The only thing is that the views load and display the content (buttons, UITableview)...but the UITableView doesn't actually load the data, and when I press the buttons nothing happens. when I instead remove the container views and test the two ViewControllers separately, they work perfectly. How can I fix this?
I had copied and pasted the content from one view controller to another, and even if the mach up's with the .h file where still there, they didn't work. I deleted all of the content and added it again

Resources