-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUIViewController+NibName.m
36 lines (32 loc) · 1.04 KB
/
UIViewController+NibName.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#import "UIViewController+NibName.h"
#import "UIDevice+Resolutions.h"
@implementation UIViewController (NibName)
-(NSString*)getResolutionedNibName:(NSString*)nibName{
UIDevice *currentDevice = [UIDevice currentDevice];
NSString *name;
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
name = [NSString stringWithFormat:@"%@_iPad",nibName];
}
else if([currentDevice resolution] == UIDeviceResolution_iPhoneRetina4){
name = [NSString stringWithFormat:@"%@_iPhone5",nibName];
}
else {
name = nibName;
}
return name;
}
+(NSString*)getResolutionedNibName:(NSString*)nibName{
UIDevice *currentDevice = [UIDevice currentDevice];
NSString *name;
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
name = [NSString stringWithFormat:@"%@_iPad",nibName];
}
else if([currentDevice resolution] == UIDeviceResolution_iPhoneRetina4){
name = [NSString stringWithFormat:@"%@_iPhone5",nibName];
}
else {
name = nibName;
}
return name;
}
@end