I have develop one universal app. I have four type images
iphone - simple.png
iphone retina - simple#2x.png
ipad - simple#3x.png
ipad retina - simple#3x#2x.png
When i try to run the application, it works fine into ipad (non retina) but it gives black screen (no images) into ipad retina.
Here, put code of function which give me related name for iphone & ipad.
#define SHImageString(str, ext) ({ UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ? ([NSString stringWithFormat:#"%#.%#", (str), (ext)]) : ([NSString stringWithFormat:#"%##3x.%#", (str), (ext)]); })
Thanks in advance.
It should be like this:
iphone-simple.png
iphone retina - simple#2x.png
ipad - simple_iPad.png
ipad retina - simple_iPad#2x.png
In your code (or XIB) you only use the files without the #2x. If the app is run on a retina display it will automatically use the #2x version. I've used this many many time, works perfect.
Related
I have created iPhone app with a lot of images as interface details. After completion, i decided that i also want to support iPad. So in size classes i chosen REG REG and edited constraints for new device.
Now I have a problem. All images in iPad mode are distorted. Absolutely all. I test on iPad 2 and physical iPad mini. For example I have a png with text
here it is on iPhone 6+
here of iPad2
as you see on iPhone it is smooth, but on iPad pixellizated.
And that happens to all images
Why can this happen ?
As the resolution of both, iPad and iPhone differ from each other, and you are comparing an image of iPhone6+ with iPad, so iPhone6+ will take #3x image while your iPad mini and iPad 2 will take the images of size #2x(if they are retina). So to support the image for iPad you have to add the images for iPad in your images.xcassets folder if your are using the xcassets like this
To get the options for images you have to select your xcassets folder then from the attribute inspector you have to check iPad.
I have developed an universal app and i import my graphics stuff. I came across with the following thought. If the icon that is referred to iPhone retina display and the file that is referred to iPad non retina display has the same size, is there any way not to import the same file with different names (icon#2x.png & icon~ipad.png) twice?
I am not sure if there is such an icon size that would have same size for iPhone retina and iPad non retina device(Pardon me if I am incorrect). If you are talking about any normal image that you want same for iPhone retina and iPad non retina, and you want the app to automatically select the same image for both devices mentioned above then, no. You can manually do that though, which you probably already know.
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.
i've been writing an app for iPad. I used 2 images, menuBar.png and menuBar#2x.png, on for normal and the other for retina. When i run on simulator, it's perfect. But when i built and run on iPad 3, it seems doesn't load the retina image.
Can anyone give me a solution or show me where i go wrong?
The image should be called:
iPhone non-retina: menuBar.png
iPhone retina: menuBar#2x.png
iPad non-retina: menuBar~ipad.png
iPad retina: menuBar#2x~ipad.png
if not named liked this, it will fall back to the iPhone non-retina image
I am designing an app for 9.7 inch iPads. I would like to know if anybody has any experience on how an app designed for bigger iPads looks on iPad mini? Does it scale down automatically, somehow that is perfectly usable on the smaller screen? Or should I take any considerations into account? I have not downloaded the latest Xcode, so I am not aware if it has an iPad mini simulator. But my concern is the Physical device, even if Xcode has iPad mini simulator.
From an app's point of view, the iPad mini is identical to an iPad 1 and iPad 2. The screen has the same number of pixels - 1024x768.
Of course the screen on the iPad mini is physically smaller. This is generally only an issue if you need to draw something that comes out to a specific physical size. An example might be if you need to display a ruler in inches or cm. Otherwise it's a non-issue.
There is no separate iPad mini simulator in Xcode. There is no need for one. The screen renders at 1024x768. This works for all non-retina iPads, including the mini.
From a usability point of view, an iPad app running on an iPad mini versus the other iPads, buttons and text will be slightly smaller due to the physically smaller screen. Some people may argue that some apps would benefit from using a larger font or bigger touch areas. But in reality this shouldn't be an issue. The iPad mini has the same DPI as iPhones and iPod touches. If people can use those devices OK then they can use an iPad mini OK.
A debug tip to test on your iPad how your design will render on an iPad Mini : create a button somewhere in your app and add a target to the following method :
#ifdef SIMULATE_MINI
-(void)toggleMini{
static BOOL isMini = NO;
static float fl = 7/9.7f;
isMini = !isMini;
[myWindow setTransform:
isMini?CGAffineTransformMakeScale(fl,fl):
CGAffineTransformMakeScale(1,1)
];
}
#endif