I just can't find the "Create iPad version" button in Xcode 4 because I want to turn an iPhone XIB in an iPad XIB, does anybody know where I can find this button in Xcode4?
This is somewhat hidden. You'll need to create a duplicate target. Select the project in the navigator, then right-click the target and select Duplicate. Choose to Duplicate and Transition to iPad. A group called "Resources-iPad" will be added to your project and will contain the iPad-converted xibs.
You can also do a search-and-replace on a copy of your iPhone .xib file in a text editor, replacing the term "IBCocoaTouchFramework" with "IBIPadFramework".
In addition to Joshua's step you need to set the target to iPhone or it doesn't give you the option to "Choose to Duplicate and Transition to iPad". If the target is set to universal it does not work.
A slightly longer way, to build one from scratch. When all else fails, try the following:
You have to create, through Xcode4, a new MainWindow file for the iPad version.
In Xcode 4, File > New File.
Choose IOS > User Interface > Application, then Next.
Choose Device Family (assume iPad).
Call it MainWindow-iPad.
This creates a new MainWindow-iPad.xib file.
Now, you have to link it to the app delegate.
Click on the new MainWindow-iPad.xib file under your file tab.
Click on App Delegate.
In the inspector window, choose the 3rd pushpin. This is the identity inspector.
Choose the class of your appDelegate.
Now, link it to the window for the screen, plus add any navigation controllers, etc., for this screen.
Go back to the app delegate row under objects, and control-click from the app delegate to the Window, to make that an outlet.
Drag Tab bar controller from the library, and add it below the window.
Control-click on the app delegate, dragging to the tab bar controller. Make that an outlet.
This gives you a complete MainWindow-iPad file.
Now, select the Target, change deployment to Universal, and change the Main Interface under iPad Deployment Info to MainWindow-iPad.
That should do it!
Related
I'm using XCode 10.1 and it seems they yet again changed things nobody asked for, and now I can only add new elements to a storyboard via a circular menu on top.
Fine, however when I open the storyboard in a new window, this menu is not showing, and they removed the old way to add new UI elements. So any way to use the new menu in a separate window?
Thanks
If you hold down the Option key when clicking the Library button in the project window toolbar, the object library will stay open in a separate window, and you can access the user interface elements from your storyboard opened in a new window.
See matt's answer to the following question for more details:
Where did the Object Library go in Xcode 10?
In the middle of my creating the app, xcode quit allowing me to ctrl-drag UIButtons to VCs for creating IBActions. This happens on every VC (nine in all). It does allow for creating Outlets, though. (Pls see image -> no Action selection is showing)
xcode Version 7.2 (7C68) build target is ios9.
Is there a way to fix this?
Some things to try:
Make sure you are using one of the "Sent Events" to create the IBAction - not a Triggered Segue (that will do what you are describing) or other connection.
Try connecting not just via Ctr-drag, but via the right click menu or connections menu.
Try adding the code:
#IBAction func myAction()
{ }
... a clear circle should appear, which can be connected via dragging to the button in IB. This will create a Touch Up Inside event.
Finally, restart your project and try again.
So far the only working solution I have found is to use:
[NSApp setApplicationIconImage: myImage];
But this message is sent after the default icon is already in the dock, so it's not working: the icon is initially set to the default application icon. I have not found the correct place to send this message.
I have read this: How can I set the icon for a Mac Application in Xcode? but it seems a bit too old to be useful for XCode 4.3
What is the standard way to set the dock icon, and even more importantly, where in the documentation is this described ?
I have trashed 4.3 two days ago, so I am using 4.5 developer preview to explain, but it should be similar.
Open up you project
In the left inspector be sure you are in the project navigator
Click the top node which should be named like your project
The middel section should now show some summaries of your project
Click on your Project name under "Targets"
The middle section should now show some Tabs, get on "Summary"
Drag your Icon file to the App Icon field.
Hope that helps.
I've got two menus in my app, one will be attached to NSStatusBar and another will be app's main menu.
Is there a way to set one of the NSMenu's as the main one right from the Nib? I'm looking at another project's nib and I see the menu actually defined in the nib, while in my nib it's not showing up correctly.
Right now my app has no menu at all.
This is what my nib looks like:
How I want it to look like:
In xibs, at least in Xcode 4, the main menu is no longer an outlet of the application but rather a nature that a top-level menu object either has or doesn't have. The main menu in a main menu nib created by Xcode has that nature; a menu you create yourself does not.
As of Xcode 4.2.1, there is no way to create a menu from scratch in an existing nib and appoint it as the main menu. You must create a nib with the main menu already in it using the appropriate file template.
Before I used to open the inspector window ( Segmented Control Attributes) like:
Now that I upgrated to Xcode 4.0.2 I have this:
How could I open the Inspector window in Xcode 4.0.2?
I think the problem might be that you've hidden the Utilities view. To re-enable this, simply click on the rightmost of the "View" icons in the main window, as shown below.
Incidentally, if you just single click on the .xib file, it'll open in the main view rather than a new window, which is probably more useful in this instance.