Skip to content

Instantly share code, notes, and snippets.

View carlj's full-sized avatar

Carl Jahn carlj

  • Deutsche Telekom
  • Wiesbaden
View GitHub Profile
@carlj
carlj / gist:3782351
Created September 25, 2012 14:44
iPhone 5 UIImage Category
+ (UIImage*)imageNamedForDevice:(NSString*)name {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
if (([UIScreen mainScreen].bounds.size.height * [UIScreen mainScreen].scale) >= 1136.0f)
{
//Check if is there a path extension or not
if (name.pathExtension.length) {
name = [name stringByReplacingOccurrencesOfString: [NSString stringWithFormat:@".%@", name.pathExtension]
withString: [NSString stringWithFormat:@"-568h@2x.%@", name.pathExtension ] ];