Created
January 24, 2013 16:08
-
-
Save sendoa/4624022 to your computer and use it in GitHub Desktop.
Obtenido de http://www.integratingstuff.com/2012/02/25/some-ios-development-tips/ Macro para programar apps universales y ejemplo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifdef UI_USER_INTERFACE_IDIOM() | |
| #define IS_IPAD() (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) | |
| #else | |
| #define IS_IPAD() (false) | |
| #endif | |
| #import "UiUtil.h" | |
| @implementation UiUtil | |
| +(NSString *) getNibNameFrom: (NSString*) nibBaseName{ | |
| if (IS_IPAD()){ | |
| NSMutableString *nibForiPad = [NSMutableString stringWithString: nibBaseName]; | |
| [nibForiPad appendString:@"-iPad"]; | |
| return nibForiPad; | |
| } | |
| else { | |
| return nibBaseName; | |
| } | |
| } | |
| +(NSString *) getBackgroundNameFrom: (NSString*) backgroundBaseName{ | |
| if (IS_IPAD()){ | |
| NSMutableString *backgroundForiPad = [NSMutableString stringWithString: backgroundBaseName]; | |
| [backgroundForiPad replaceOccurrencesOfString:@".png" withString:@"-iPad.png" options:0 range:NSMakeRange(0, [backgroundForiPad length])]; | |
| return backgroundForiPad; | |
| } | |
| else { | |
| return backgroundBaseName; | |
| } | |
| } | |
| +(CGFloat) getFontModifier{ | |
| if (IS_IPAD()){ | |
| return 2; | |
| } | |
| else { | |
| return 1.0; | |
| } | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment