Go back from Storyboards to XIB - ios

Not knowing that Storyboards are iOS5 only I created project that could be run even on iOS 2.0, but now I can't compile it with target lower than iOS5. Is there an easy way to go back to simple XIB file?

I don't think there's an automatic way to downgrade. Create new xib files for each view controller that needs them and link their view with the appropriate .h file. You should be able to copy and paste your whole UIView container view from storyboard to an xib though so it's really not that bad.
EDIT:
Also, I recently had to do this myself and a few things that weren't immediately obvious to me were that I also had to create a MainWindow.xib file, change your application plist, main.m, and my app delegate. Was definitely more complex than I expected but can confirm it can be done.

Related

Can Xcode Add Items To A Storyboard, In Editor, Through Code? [duplicate]

So far I have seen documentation of how to write a storyboard with Interface Builder. I prefer writing the code manually though. Can a storyboard be developed manually without interface builder in xcode?
I would not recommend this, however, if you right click on your storyboard file in the Project Navigator choose the option Open As > Source Code you can hack away to your heart's delight.
I would imagine you'd prefer editing a Storyboard using IB as you'll just be creating more work for yourself debugging various syntax issues that the editor would have abstracted away for you. Note, that the XML is compiled at build-time into the binary files called nibs, then loaded and instantiated at run-time to create the views. Getting your hands dirty with that will slow you down.
https://developer.apple.com/library/ios/documentation/ToolsLanguages/Conceptual/Xcode_Overview/Edit_User_Interfaces/edit_user_interface.html#//apple_ref/doc/uid/TP40010215-CH6-SW1
BTW #Kenny's suggestion to write your views in code is a good one if you really don't want to use XIBs or Storyboards
If you prefer writing code, I would suggest doing everything programmatically and not using storyboards at all.
Do you use a text editor to write text files? Then use the storyboard editor to write storyboards.
At the end of the day, if you wanted to reverse engineer a storyboard file you could do that, and then hard code your own, new one using what you've learned.
Here's a clue: XML.
Alternatively, ignore storyboards completely, and just programatically create all your views, segues and transitions. That is perfectly feasible.

Multiple main storyboards in one Xcode file

I am currently working on a mobile app on Xcode (I believe Xcode 11). I have the original main storyboard in tact. However, I ended up duplicating the main storyboard and renaming it something else, then I completed another component on that interface of that storyboard. However, I now want to merge the duplicated storyboard with the original main storyboard without having to make another view controller on the original one but I don’t know how. Help?
What best you can do is store copy duplicated Storyboard on desktop . Resolve conflict by considering Main Storyboard . Now Copy Controllers you have made on duplicate Storyboard from desktop into your main Storyboard.
Thats what I prefer to do when multiple developers working on same Storyboard.

GLKView in IB will cause crash when app is run without Xcode

I have an app that displays a ViewController at some point, which includes a GLKView. All defined within a storyboard.
It works just fine, that is, unless you run the app from the phone itself, not launched from within Xcode. Upon presentation of the ViewController and therefore the GLKView, the app instantly crashes.
It doesn't matter if the Installed checkbox is ticked or unticked for the GLKView. Only when I delete it from the storyboard altogether, it won't crash.
Any ideas?
I don't know why these things happen but I would consider them a bug. A similar situation happens when adding a WKWebView directly from storyboard. For both the solution is pretty simple: All you need to do is import the module for it. So in your case in your view controller add:
import GLKit
It seems otherwise the framework is not loaded or something.
With ObjectiveC the problem seems to go a level deeper. It seems that the module must manually be imported. Go to your project settings. Select your target. Select "General". Scroll down to bottom and find "Linked Frameworks and Libraries". Below it find a "+" button and search for "GLKit.framework" and add it. This should fix the issue.

iOS storyboard back to viewcontroller.xib files

after using storyboard in my project, I decide to go back to each of the viewcontroller having its own xib. reasons:
1. when project has many scenes and viewcontroller, open one storyboard file in xcode is extremely slow no matter how fast your computer is.
it just doesnt get any benefit on overview when you have huge projects.
editing is suck. moving ui elements within the some views. it just pain in the ass experience ever.
so my question, how to convert back storyboard to every single viewcontroller xib files, just wanna know if there is automatic way to do so.

Missing ViewController.xib in Xcode 5

I'm new to iOS programming and is currently following the tutorial at http://codewithchris.com/demo-app-with-xcode-and-interface-builder/
We first create a new project using the Single View Application library.
Question: About half way into the tutorial, it says Once you have ViewController.xib opened on the left pane and ViewController.m opened on the right pane... However there is no .xib file anywhere in the Project Navigator, and this is the first mention of an .xib file in the tutorial.
Am I supposed to get a .xib file somewhere along the way? If so, which step will create the .xib?
XIB is an older format of Interface Builder. In newer versions of Xcode, by default, the project is created with a storyboard (Main.storyboard in your project). The difference is that in storyboards, you can see all the views of your app at once (and transitions between them), and with XIBs you have to keep them separately.
I'm not sure about this (can't check it right now), but if you insist on using XIBs, there should be a checkbox somewhere during creating a project. Anyway, I recommend you getting familiar with the storyboards, they are supposed to be a successor to XIBs.
As I can see in the tutorial, the author says 'XIB' even if he has a storyboard in his project, probably because he got used to XIBs. All in all, they are very similar in usage.
Actually storyboards contain .xibs (in your project one .xib as you created single view app.) The xib is just the user interface file shown in your second screenshot.
You just have to click the "Show assintant editor" on top right (the button with the suit) to split the xcode window and see the xib alongside the viewcontroller header/or implementation files.

Resources