My OS version is OS X Version 10.9.4.
XCode Version is 6.0.1
Everytime I create a new project ,the storyboard is always for ipad even I choose Device to iphone.The old projects with iphone storyboard work fine.But Everytime I create a new project whatever I choose ,it is always ipad storyboad.Please help me!
You can change it programmatically
NSString *storyName = #"MainStoryboard_iPhone";
if ([[UIDevice currentDevice] userInterfaceIdiom] ==UIUserInterfaceIdiomPad) {
storyName = #"MainStoryboard_iPad";
}
UIStoryboard *story = [UIStoryboard storyboardWithName:storyName bundle:[NSBundle mainBundle]];
or made by default the storyboard on your settings projects. On General, deployment target, main interface, switch between iPhone / iPad
On xCode 7: select the View Controller, click on Attributes Inspector at the top of the Utilities sidebar (left side.) At the top is a size drop down. Use it to select the size you want to view.
Appears this has to be done for each ViewController.
Related
Long time lurker, always tried very hard to search and have found many answers this way. This is the first time I have found nothing that fixes my problem. This is also my first solo app, as I am a new developer.
I have two devices- an iOS 8.1 iPhone 6, and an iOS 7 iPad Mini Retina 2.
I am building my first iOS app. It uses storyboards for a UITabBarController with three tabs, each of which contains a UINavigationController and a custom sub view controller (such as a subclass of tabbarcontroller or collectionviewcontroller).
Under Deployment Info:
Deployment Target is set to 7.0 and Universal. iPhone and iPad both use the MainStoryboard main interface, with all four Device Orientations checked for both.
My AppDelegate starts with:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"MainStoryboard" bundle:[NSBundle mainBundle]];
UITabBarController *initViewController = (UITabBarController *)[storyboard instantiateViewControllerWithIdentifier:#"rootTabBarController"];
NSLog(#"%d %d",initViewController.shouldAutorotate,initViewController.shouldAutomaticallyForwardRotationMethods);
[self.window setRootViewController:initViewController];
Note the NSLog; it prints "1 0".
So from what I can see- the tab bar should auto rotate.
On my iPhone, when I turn the device sideways, the status bar on the top rotates- but the content remains upright. If I hit the Home button and switch back to the app while holding it sideways, everything goes wonky- the content rotates but doesn't rearrange the layout, so it remains vertical, and thus gets cut off and there's a big black section on the side.
On my iPad, though- everything works fine! The application rotates as expected and resizes itself.
What am I doing wrong here? Thank you tremendously for any help.
Why are you programmatically loading the storyboard? If there's no specific need to do that, I'd suggest just using the template app delegate code. Better yet, create a completely new, fresh project and just copy over your storyboard. It won't necessarily make sense, but... I bet it will work!
I created my project back before iOS8 and Xcode 6 came out. I'm supporting down to iOS 6.0, and have two Storyboards, one for iPhone and one for iPad.
Now, in Xcode 6, I'd like to add support for the new screen sizes (iPhone 6/6plus). When creating a new Storyboard, it is using the new format (square), which is good, but I'm not sure how to proceed. Can I decide which devices uses which storyboards? Or is the new Storyboard-setup supported on older iOS-versions?
Can I throw away my old Main_iPhone.storyboard and create a new Xcode6-storyboard (with support for iPhone 6-sizes) while still supporting iOS 6/7? Or do I have to keep the old storyboards to work with versions below iOS8?
If I need to keep them, where do I set the logic for which devices use which storyboards?
we can use more then one story board in one project.and call particular story board and identify the particular viewcontroller according to the identifier.
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:#"Main" bundle:[NSBundle mainBundle]];
PlaceDetailViewController *place=[mainStoryboard instantiateViewControllerWithIdentifier:#"placedetail"];
[self.navigationController pushViewController:place animated:YES];
}
I have Xcode 6 beta installed and I'm trying to develop an universal app. Before Xcode 6, you had to create 2 separate Storyboards for iPad and iPhone and you could set it in the Deployment Info.
In Xcode 6, it seems that separation is gone. There aren't 2 tabs to set the storyboards individually.
But when you go to create a Storyboard, you are asked to choose a device family.
Can someone explain what's going on in Xcode 6 please?
Thank you.
To support the new Size Classes, you'll need to enable "Use Size Classes" in the File Inspector of your storyboard. This will allow you to configure your storyboard for multiple device sizes.
Note that this will make your storyboard incompatible with Xcode 5.
When you've enabled this, you'll see the size selector appear at the bottom of the screen. Use this to select your device size:
In your project preferences, you can still select a different storyboard for iPhone or iPad using the dropbown box. Notice that the storyboard name will persist if you select a different one for each device.
Even though this is still an option, Apple is moving developers towards a single, unified storyboard.
It seems Auto layout is used to support all devices now, yet you can create separate storyboards? Have you tried calling the separate storyboards in code in the app delegate
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
//Use iPhone Storyboard
} else {
//Use iPad Storyboard
}
After Xcode 6 > version for using different storyboard for iPhone and iPad need to follow xcode-6-separate-storyboard-for-ipad-and-iphone
Note : For Application which does not use Auto Layout, so while adding new storyboard for iPad and disabling auto layout, a pop will appear that's where you need keep size class data to iPad as shown in below screen.
I've Created an iPhone App.I Want To Make it Universal on Next Version But When I Choose Universal From Deployment Info Menu it Does not Creat Main-iPad Storybiard.Anyway I Created it Myself and When I Tried too Test it on iPAd it shows iPhone storboard!
You have to create an ipad storyboard, click on the ipad button under the universal setting, and then set the ipad storyboard there: Here is what you're needing to do.
Edit:
Since you are still experiencing the iphone look on the ipad, go to your .plist file, and check for:
hope it helps
The storyboards are created and configured automatically when you create the project in universal mode. If you started for iPhone only, and switch to universal later, you'll need to set the different storyboards in the project settings.
To do so, go to project settings and choose your target. Note that in 'Deployment info' under your choice for 'Universal' there are two buttons 'iPhone' and 'iPad'. You can select 'iPad' there and select your iPad storyboard.
You need to create iPad Storyboard, not iPhone.
And You need to select that storyboard at general tab(At targets).
Maybe change in the app delegate this:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"MainStoryboard" bundle:nil];
To something like this.
UIStoryboard *storyboard;
if ([[UIDevice currentDevice] userInterfaceIdiom] ==UIUserInterfaceIdiomPad) {
storyboard = [UIStoryboard storyboardWithName:#"MainStoryboard_iPad" bundle:nil];
} else {
storyboard = [UIStoryboard storyboardWithName:#"MainStoryboard_iPhone" bundle:nil];
}
I want to test an iPhone app on the iPad, but I only have iPad now. IOS5.1 & Xcode 4.3.1 that are my environment and I set the same storyboard in the project TARGETS, the app runs on the iPad has been fullscreen displayed (all of the UILayouts have been stretched), cannot show any view switch in the app.
How can I run the same size app on the iPad?
You need to change the app target from Universal to iPhone.
Go to [Project Targets] > Summary > iOS Application Target > Devices > iPhone
This way the iPad will open your app as a legacy iPhone app.
Not sure how to do this with storyboards but with normal UIViewControllers you would have seperate xib files for iphone/ipad and check which one to load like so:
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.motionJpegViewController = [[MotionJpegViewController alloc] initWithNibName:#"MotionJpegViewController_iPhone" bundle:nil];
} else {
self.motionJpegViewController = [[MotionJpegViewController alloc] initWithNibName:#"MotionJpegViewController_iPad" bundle:nil];
}