Skip to content

Instantly share code, notes, and snippets.

Created October 21, 2012 06:26
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Convenient class to handle the new iPhone 5 taller screen
#import <Foundation/Foundation.h>
@interface Device : NSObject
/** Returns true if it is a iPhone/iPod with 4 inch tall screen */
@interface UIImage (iPhone568)
#import "Device.h"
@implementation Device
+(BOOL)isScreen4Inch {
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 568)
return YES;
return NO;
@implementation UIImage (iPhone568)
+(UIImage*)imageNamedFor568h:(NSString*)imageName {
if ([Device isScreen4Inch]) {
NSString *imageNameFor568h = [NSString stringWithFormat:@"%@-568h.%@", [imageName stringByDeletingPathExtension], [imageName pathExtension]];
return [UIImage imageNamed:imageNameFor568h];
return [UIImage imageNamed:imageName];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment