Container View not available in Xcode Storyboard - xcode6

Does anyone have any idea why I wouldn't be able to find the Container View in Xcode when on a storyboard? I've added on in this project, but now I can't seem to be able to add another one

I think container views are only available in storyboards. If you are editing an individual view file (an xib), then containers are not available.

Related

View Controller Management in IOS

I need help with my control viewers in Xcode. In my storyboard, I created a navigation view controller. In which I created one view controller as my root view and added several objects in it.
Now in the general way, I'm trying to Ctrl + drag Element onto my View Controller. It doesn't show any Blue line like it is supposed to so.
Also I wish I can get some explanation or tutorials describing the method of creating views and controllers and linking them.
This is great tutorial to understand storyboards(single view for all the views in application) and Segues (transition between views). Go through both parts.

How do I add a new view to a single view application in Xcode

I started my app as a single view application. I have the view with various buttons and labels connected to code. I want to add a button that links to another view.
I found a tutorial that guided me to click on the project and add a UIView subclass. However there is no option for that ( I think because I started it as a single view application).
I'm pretty new to all this so if anyone can outline a simple way for me to do this that would be great! I am using Xcode version 4.3.2.
Thanks!
You need to add a new Objective C class. Please refer to this:
How to create new View Controllers in XCode 4.3
If you started the app as single view using xib file the to add a class just go to name of the project on the left pane and right click on it. Then choose add new file. The pop up will appear to allow you to choose what type of class you want to add. Depending to what the new view is you can choose uiview controller or uitableview controller and so on. Just make sure you check mark with xib for interface user. That should do it. Hope it helps.
Adrian

How to replace the FirstViewController in a TabBar app with another view controller (Kal)?

I created an empty iPad TabBar application using XCode 4, without storyboards. I placed that app in a workspace. I then added the Kal source (obtained from the iPad Juice build) to the workspace as a separate project. The initial build was clean.
I then went to the Kal example (NativeKal) and added EventKitDataSource.h and .m, and NativeCalAppDelegate.h and .m. (The image below shows what files are in the example project)
This is the code from the NativeCalAppDelegate.h file:
I tried setting the first TabBar UIView controller to "KalViewController" as I would normally do when using Storyboards, but it isn't listed in the drop down list of classes.
The question is: how do I get the NativeCal example view controller to replace FirstViewController in the in my TabBar application?
Comments added as Answer.
My recommendation is to switch to storyboards it is a lot easier to do UITabBarControllers in them. You can do this by just creating a new storyboard and copy and paste everything into it and then control drag from the UITabBarController to the UIViewControllers that you want to be linked to the tab bar controller and it does the rest for you, everything else is the same after that. In storyboards you can set the first view controller to be loaded so if you need it to be KalController then you can set it when you set up the UITabBarController. You can also set this in the code. I found that storyboards were a great new feature to xcode, UITabBarCotrollers are a lot easier to do in them then in .nib files I could never get them to work.
Hope this has helped.

Extracting nibs/xibs from storyboards (iOS)

I have created a simple project with a storyboard, and now realize that they don't support iOS 4.x and that I would like users with these devices to be able to download my app. The app is just a flipside view controller, and is fairly simple but if there's a way to just extract the XIBs from the storyboard I'd much prefer to do that than recreate it.
tl;dr: getting .xibs out of a .storyboard?
Xib files cannot be extracted from the storyboard but you can instantiate UIViewControllers out of the storyboard by instantiating your storyboard into a UIStoryboard Object and getting the UIViewController via its identifier, here's how I do it:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:
#"MainStoryboard_iPhone" bundle:[NSBundle mainBundle]];
UIViewController *myController = [storyboard instantiateViewControllerWithIdentifier:#"myId"];
hope this helps.
I found that the simplest method was to copy and paste the items out of the storyboard, one view at a time, and recreate the view controllers for each one.
However, for anybody who does this, note that you have to make a xib for MainWindow in addition to all of your other XIBs, and hook it up accordingly, including setting up the window and app delegate. Storyboards handle all of this for you, so when you try to avoid them, you have a lot of manual setting up that creating non-storyboard projects from the get-go handles for you. Don't do what I did, and try to make your root controller your main view controller, because it will go nuts saying things about how UIApplication isn't key-value compliant for individual properties of your XIB.
As a few others have suggested, your best bet is to clone the views from storyboard into an XIB.
It's not possible to get xib files. Your storyboard is compiled to nib files and packaged into a storyboardc file within your app bundle.
To locate the nib files select your built executable in Finder and right-click 'Show package contents'. Navigate to the en.lproj directory and find the storyboard.storyboardc file. Right-click 'Show package contents' again on the storyboard file and you will find your nibs. They will not be much use to you though because they are compiled binary nibs.
You may not be able to extract the .xibs from the storyboard, but try this. Have your .xib based project open and create the empty .xib files for your views and also have the storyboard project open at the same time. Select all the UI elements in your storyboards scene and simply drag and drop them over to the .xib based project. I have done this the other way around (moving from .xib to storyboard) with no problems.

Change view of detail pane on UISplitViewController

I am working on an app to try and learn a bit more about the cocoa touch framework and am starting to use the UISplitViewController. From what I have learned so far, this has a property called viewControllers that is an array containing the master and detail view controllers for the app.
What I am trying to set up is a folder navigation system in the masterVC, then when a specific file is selected, it is opened in the detailVC. I have got the folder navigation working and can pass the details of the files between the two view controllers.
My problem is that there are several types of files that require different views to display them correctly.
For example a jpeg image will have an image viewer, whereas an html document will have a web view and a txt document will require a text editor view.
What is the best way to change the view controller of the detail pane?
Am I better to have a single View controller and swap different views in and out depending on the file type? Or is there a way to completely remove the viewcontroller and add the appropriate one in its place?
Thanks
I would think you should use multiple view controllers. There's bound to be a lot of logic in each of these individual view controllers you mentioned that should be properly contained within its own view controller.
As for displaying the appropriate view controller, you can easily add a view of a UIViewController to any UIViewControllers view, by doing: [self.view addSubview:myTextEditorVC.view]. So in other words, your detailVC could handle the logic of knowing which type of UIViewController it needs to display, instantiate that UIViewController, and display its view within the detailVC's view.
Hope this helps!
You should be swapping out different view controllers. In Xcode 6, you can use a "Show Detail" segue from the master to point to a different navigation controller that contains your different detail view.
Here's an quick example.