i have a tabbar controller created by interface builder. It has 5 tab with 5 views.
Now i can porting this project in ipad compatible version.
Using xcode and IB i created the correct views for ipad with "create ipad version using autosizing masks".
I have TestView_iPad.xib and TestView.xib
Ok!
Now, how can i load at startup in my tabbar controller the iphone or ipad correct nib file??? What is the right way?
I need to do this in my testview controller or in my appdelegate?
I recognize the devices correctly, but i not able to load from different nib file, because it where setted from interface builder (Nib Name = "TestView" from Inspector)!
someone have a trick?
thanks,
A
For my iOS app, I use two different NIBs and yes, they both have UITabBarControllers. The way I do it is by adding a key to my Info.plist: Main nib file base name (iPad) and copy the iPhone xib and rename it (Example: TabBar_iPad.xib) Then add your new xib's name as the value for Main nib file base name (iPad) and enter the xib's name destined for the iphone under the key Main nib file base name (iPhone)
It works great!
Related
I am trying to upgrade my existing iPhone app project to an Universal app,
I have implemented following steps,
Step 1: Project Navigator - target - Summary - devices - Universal (From iPhone to Universal)
Step 2: Created TabBar with NavigationBar Flow in Storyboard,
When i run my project in iPhone it works properly but when i run in iPad it shows only TabBar with NavigationBar.
Now my problem is how to create new .xib files for iPad ? Xocde doesn't created automatically when i selected my device from iPhone to Universal.
or
How to map my iPhone .xib files with iPad.
Do i need to create new Outlet and action for all buttons which are there in my iPhone .xib?
Thanks in advance.
Create a new xib for all your view controllers ,name the view controllers with "~ipad " as a suffix(ex. FirstViewController~ipad.xib)
xcode will automatically use the xib when the application run in ipad. Link your newly created xib with appropriate classes through identity inspector in xib.
Note : After creating a new xib, add all the controls as added in existing view controller and link newly added controls with file owner.
add all the controls and link with file owner.
I want to use generally the old .xib files in my iPhone application. But when it comes to tableViewController storyboard is a lot more convenient in order to make custom cells etc. Is it possible to make a .xib based application and in the middle of it, to use a storyboard for a UITableViewController and its DetailedViewController only?
You can use a storyboard for any part of a program. Storyboards are not an all or nothing concept. You can have just one view controller in a storyboard, or a small network that just represents a subsection of your app.
To use just one view controller from a storyboard:
Add a new storyboard to your existing project.
Add a single view controller to the storyboard.
Assign an identifier to the view controller in the inspector.
Use the UIStoryboard class to load the storyboard resource
Use -[UIStoryboard instantiateViewControllerWithIdentifier:] to create a new instance of that view controller.
Install the view controller some place in your app by doing something like pushing it on to a navigation controller, or run it modally.
Both can work fine together (Storyboards and Nib files). In the TVC that is part of your storyboard, just instantiate the destination VC in code and use the usual initWithNibName method to load the nib file.
You can add a storyboard to any project, but the point of storyboards is to centralize your XIB files into one location rather than having 10 XIB files you can have 1 .storyboard file that contains 10 scenes representing your views. This shows your connections to other scenes, and you can manage all the seques and transitions of each scene. So is it possible, yes you could add a storyboard to your project, but I would recommend you design you entire application in a storyboard if you want to use them.
In iOS 5 sdk with Xcode4.2 i started creating an app with Empty Application Template.But in that template there is no MainWindow.xib.Some posts says to add a MainWindow manually.Is that the right way or proceeed the same without MainWindow.xib for a navigation Based application
The empty application template does not contain any other files - it's an empty template! If you want to create a navigation based application, you can do it in code by creating a navigation controller and setting it as the root view controller of the application window, or you can create your own xib file and set it to the "Main Interface" in your target summary settings.
For information, in XCode4.2/iOS5.0, Apple added the concept of story boards. Now by default, no MainWindow.xib file is created but MainStoryboard.storyboard. You can use it to develop your application. BUT, for backward compatibility, prefer add a nib file that you can name MainWindow.xib. I do not know any other way to use NIB files as it was done before XCode4.2
i have created an application in iphone. i have created all my controller files without an xib. After the controllers have seperatedly created xib from the user interface section and and i started linking the xibs that i have created seperatedly with my controllers .But the problem is that it does get connected with my class.How to connect the xib with my class.Please anybody help me in solving this problem.
open inspector for the xib file
go to the last tab of it
select the controller class for the xib
then open the xib and open the interface builder and make the connection with the view component if you have any
run and enjoy.
I have a navigation based iPhone app, and I want to load a view (MainMenu.xib) when the app is launched, instead of MainWindow.xib. If I change the target's "Main Interface", the app crashes when it is launched. How do I fix this?
You have to add the view you want to display on MainWindow.xib......in the IB of MainWindow.xib you have to change the name of the class as well as the nib name (give the name of the class)
After doing this make the object of the view in the Application delegate
In navigation based you also need to give the name of the class you want to display(this class is the class in which you had designed your table view)
adding this comment a few years after the problem first posted as can cause problems if you have Storyboards to manually change MAIN INTERFACE instead of choosing from drop down. If value in field is not a .storyboard file then xocde changes the plist setting to NIB based project and breaks the whole project.
See my comment here
What does "Main Interface" in Xcode actually *do*?