Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios6 UIImageView - Loading -568h image

Tags:

ios6

I've seen a couple posts about the UIImage automatically loading the filename-568.png image in the new iOS6, but I can't seem to recreate it in the UIImageView class.

I'm using the Storyboard (not my app, just having to do some checks), and I've a simple layout with just the Image View scaled to fit, no code in the view controller, and I've sure the filename.png and filename-568h.png exist (as well as [email protected] just in case) but when I load it up in the iOS6 simulator. This has been for iOS 4 and 5, loading the @2x image for retina, doesn't seem to work in iOS6 though. Any ideas?

The image happens to be called Default.png since it is the same as the launch image, could this be the issue?

Thanks for any help in advance

like image 891
redroot89 Avatar asked Sep 24 '12 14:09

redroot89


2 Answers

iOS6 does NOT automatically load -568h as it does with the @2x images. The only exception is the default screen, but further than that you have to manually set you 568h image yourself.

I created some code to mimic the loading behavior for -568h images when using the [UIImage imageNamed:@""] method, but from the IB I do not know the way. If you are interested in such a solution, check it out at http://angelolloqui.com/blog/20-iPhone5-568h-image-loading

like image 126
Angel G. Olloqui Avatar answered Feb 08 '23 23:02

Angel G. Olloqui


Typically, you should only use 568h for the launch image. If you notice yourself using different image assets within your app for the new display height, you should consider that you might be making your UI too static.

The most obvious place people want to use 568h for images is for background images. An alternative is to just have one asset that has the largest possible dimensions and align it properly using the contentMode property of UIView.

But perhaps you have something floating in the image at the top and the bottom, so contentMode doesn't solve it. You could consider that the top and bottom floaters should probably be separate views anyway.

Remember, we have always been making apps with variable heights. Every time a keyboard pops up, its as if the size of the screen has shrunk.

like image 40
Richard Venable Avatar answered Feb 09 '23 00:02

Richard Venable