M
M
Max Onflic2014-08-24 20:49:45
iOS
Max Onflic, 2014-08-24 20:49:45

Why aren't files for UI signed @2x loaded on the Ipad simulator?

The fact is that on an iPad with a screen resolution of 768x1024, ordinary images are loaded, as for an iPhone. And with an iPad with a screen resolution of 1536x2048, everything is in order, also a simulator. Why is this happening and how to get out of the situation?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
Lonkly, 2014-08-24
@maxonflic

Use the special folder Assets, so you will immediately see what resources and for what permissions you have available. @2x for retina displays only

T
Trow_eu, 2014-08-24
@Trow_eu

so the first one is not a retina, but 2x for retin is loaded. add a set of 2x to the media to resolve it.

L
l0gg3r, 2014-08-27
@l0gg3r

Here is the basic implementation +[UIImage imageNamed:]

+ (UIImage *)imageNamed:(NSString *)aImageName
{
    NSData *imageData;
    if ([UIScreen mainScreen].scale == 2.0) {
        imageData = [NSData dataWithContentsOfFile:[aImageName stringByAppendingString:@"@2x"]];
    } else {
        imageData = [NSData dataWithContentsOfFile:aImageName];
    }
    return [UIImage imageWithData:imageData];
}

It checks the screen for retina and loads @2x.
but you can swizzle the +[UIImage imageNamed:] method and load the image there in your own way (as you like).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question