Setting up an universal application in ios - ios

I have created an universal application which runs fine on my ipad . But the image sizing for the iphone isnt perfect . I have tried all the view modes .Can anyone help with this issue .
I have added all the images with all the different resolutions .

Create two different storyboard/xib for iPhone and i Pad.
You have to check condition for iPhone and i Pad.
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
//for i Pad.
}
else
{
//for iPhone.
}

Check under project - Deployment Info if your iPhone and iPad refers to the correct Main interfaces (for iPhone you should have youre iPhone storyboard and for iPad your iPad storyboard).
You can find Deployment info here

Related

UI scaling in different iPad versions and iPad models?

I will launch my App for the first time targeting iPads (universal). My problem is I came across some inequalities in how the UI scales at different iOS-versions and iPad models. This is the list of different models form the iPad simulator I tested it against:
iPad 2 7.0
iPad 2 7.1
iPad 2 8.1
iPad Air 7.0
iPad Air 7.1
iPad Air 8.1 (scales perfectly)
iPad Retina 7.0
iPad Retina 7.1
iPad Retina 8.1 (scales perfectly)
Some examples and results can be seen in the Pictures below. The inequalities how the tabBar and UISlider scales in different iOS versions and models:
My questions are.
1.How come my tabBar background picture is so messed up in example iPad 2 iOS 7.0 and not iPad Air 8.1 ? (Is it different dimensions I need to consider while using a background picture?)
2.Can I possibly target different models / versions of iPads and fix my UI like you do with macros for iPhone6 / iPhone6P ? And then how?
3.How come the interface tabBar background picture scales differently in iPad Air 7.0 and iPad Air 7.1?. These are the same iPad models with the only inequalities in different iOS versions?
All help is appreciated / Regards
If you are trying to adapt programmatic elements (like image as you mentioned), you can add conditional statements to the relevant UI objects like this:
if ([UIDevice currentDevice].model == desiredModel) {
// Code here (e.g. self.imageView.image = [UIImage imageNamed:#"image"];
} else {
// Every other case
}
If I need to repeat this process often, I normally set up a BOOL and run a check in viewDidLoad (isPad = YES / NO) and then lay out using that conditional. Since you are only targeting iPad, you can set up a similar BOOL for whatever devices need certain elements.
Having said all that, I know very little about how you are setting up your interface (programmatically, storyboard, xibs), so that's all I can offer.

How to get host app screen geometry for iOS 8 custom keyboard inside iPhone app running on iPad?

My Custom keyboard has presets for each screen resolution of all Apple devices. So I have iphone, iphon5, iphone6, iphone6plus and ipad presets.
But in case user runs iPhone app (like instagram) on iPad, I need to load iphone keyboard preset and use its geometry.
Also iPhone 6 and 6+ can use stretched mode, when apps run like iPhone 5 app being stretched.
So determining UI_USER_INTERFACE_IDIOM is not a solution.
Keyboard extension and host app can see screen geometry in different ways, so I am stuck here. Need to get at least application frame for host app or any other explicit way to get that geometry.
App and keyboard extension see geometry different ways:
Also Swift key seems to have same bug while running hosted inside of iphone app on ipad screen.
Swiftkey inside iphone app on ipad:
I just found a way to check isPad on keyboard extension but I cannot make sure it is best way.
UI_USER_INTERFACE_IDIOM() && YourKeyboardViewController.instance.view.bounds.size.width == UIScreen.mainScreen.bounds.size.width
You should do this after YourKeyboardViewController.instance did called viewWillAppear(), after that the view.bounds did changed to 320x480 from 768x1024.

iOS App Landscape Mode Launch Image Not Showing

I'm developing an iOS app only in landscape mode. I'm loading the Launchscreen images as : Default#2x.png, Default-568h#2x.png, Default-667h#2x.png, Default-736h#3x.png.
The problem is that whenever i launch the app in iPhone6 or 6+ it gets the screen dimensions from iphone5.
P.S. I've tried using Images.Xcassets but it did not worked for iPhones<6.
Thanks.
Read iOS Human Interface Guidelines provided by Apple and confirm all your images are in required sizes or not. Also go through image naming conventions are approprite or not.
Because Launch Images should be picked up automatically as per device and its orientation.
Here is the link:
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html#//apple_ref/doc/uid/TP40006556-CH27-SW2
If your app is landscape only you MUST check option 'Portrait' on 'Device Orientation' section in General tab of app settings. Then you need setup orientation settings for all view controllers:
-(BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeLeft |
UIInterfaceOrientationMaskLandscapeRight;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft;
}
In Images.xcassets you need to put all images for iOS 7 & 8. After that app will be launched with proper launch image. Note that preferredInterfaceOrientationForPresentation must be equivalent for launch image orientation.

Developing universal in Xcode 6

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.

Support Retina 4-inch with a deployment target to 4.3

I'm developing an iPhone and iPad app with latest SDK and Xcode 4.5.2.
My client said me that the app has to support iOS 4.3 and above.
So, if I target iOS 4.3 I can't use:
Storyboards.
Auto-layouts.
I have to create XIB for every ViewController, but:
What must I do to support Retina 4-inch screen?
and
What must I do something to support iOS 5?
Simply design your app for 3.5" screens, and make judicous use of autoresizing masks.
For supporting Retina 4-inch screen, here is good answer to that
and YES Storyboards and Auto-layouts are not for iOS 4.3
More on iOS 5, you don't need to do and special coding for that
and YES you can support Retina 4 inch with deployment target set to iOS 4.3
Hope this info helps you..
Have a look at these two links
Screen size of iphone 5
Naming convention for iPhone 5 images?
I don't see why these wouldn't work.
Move from comments
#VansFannel I would do this in code and not actually on the xibs. So I would have something like
if(IS_IPHONE5()) {
// do one layout
} else if(IS_IPAD) {
// do this layout
} else {
// do the final layout
}
In info.plist file remove the option of Launch screen interface file base name and you wont get the issue

Resources