I have an iPhone project which completed successfully and pushed into AppStore. Now i want to change that project in to Universal project. But the problem is that iPhone layout and iPad layout is completely different. In iPhone i have common design, but in iPad it comes as a SplitViewController. Actually the problem is in xcode 6, We are dealing with auto layout and size classes. We have only one storyBoard to deal with iPhone interface and iPad interface. I have no idea about how to implement this. Implementing SplitView and configuring it for iPad when iPhone has an other design.!
If anyone already worked on these kind of projects, please tell me your suggestions. Thanks in advance.
I have dealt with the same kind of project , where I have different designs for iPhone & iPad . Though by default there is a single storyboard to be commonly used for iPhone & iPad but I added an additional storyboard and design them separately for iPhone & iPad , and in AppDelegate's applicationDidFinishLaunching method I conditionally load the storyboard based upon the device (either iphone or ipad) .
if ([UIDevice currentDevice].userInterfaceIdiom==UIUserInterfaceIdiomPad) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"Main~iPad" bundle:nil];
UIViewController *initViewController = [storyboard instantiateInitialViewController];
[self.window setRootViewController:initViewController];
}
else{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"Main" bundle:nil];
UIViewController *initViewController = [storyboard instantiateInitialViewController];
[self.window setRootViewController:initViewController];
}
App is live in AppStore at the moment with no issues. Hope this approach will help you
Related
I have an old project (started from Xcode 4) that has now two storyboard inside, one for iPhone and one for iPad. Now I want to delete the iPhone storyboard from the complete project and use the iPad storyboard and start with the Universal Auto Layout from Xcode 6. I am kinda lost how to get the iPhone Storyboard completely out. Who can tell me how to do this?
I tried with this method to force iPhone to use the iPad layout:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[ViewController alloc] initWithNibName:#"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
It loads the iPhone from the layout of the iPad as it is but is gives me some bugs, certain parts are not loading in the app such as buttons etc. that are on the main view. So it does not really do the trick.
Was actually simple (xCode6):
open file inspector and delete Main_iPhone.storyboard
in the file inspector rename Main_iPad.storyboard to Main.storyboard
in the general settings tab click iPhone and tell to use the main storyboard as well
find the info.plist in your file inspector and right click, now open as source code.
change targetRuntime from "iOS.CocoaTouch.iPhone" to "iOS.CocoaTouch"
click your storyboard in the file inspector and go to the info panel and check the box for Use Size Classes.
Done, the iPad has the default layout (still the same) and you can start building the iPhone as an adaptive layout from the iPad layout
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];
}
This question already has answers here:
Using Multiple Storyboards in iOS
(9 answers)
Closed 8 years ago.
I am a newbie programmer in iOS and I am using a Mac mini with Mountain Lion with xcode 5.x.
I want to create an iOS application, which is really big in terms of user interfaces. So working with storyboard is difficult for me. I want to create one MainStoryboard and several other storyboards, connect them in such a way that they can run together in a sequence or in particular order.
Is this possible, if yes guide me.
I think you can't push or present new storyboards from IB, but you can and load it in this way:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"Storyboard" bundle:nil];
UIViewController *viewController = [storyboard instantiateInitialViewController];
//Or use UIViewController* viewController = [storyboard instantiateViewControllerWithIdentifier:#"Storyboard_ID"];
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];
}