-
Notifications
You must be signed in to change notification settings - Fork 14
/
KarenPrefsBannerCell.m
27 lines (25 loc) · 1.21 KB
/
KarenPrefsBannerCell.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
#import "KarenPrefsBannerCell.h"
@implementation KarenPrefsBannerCell
-(NSString *) karenPrefsBannerLoadFromImage {
return nil;
}
-(id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0) {
UIImage *bannerImage = [UIImage imageNamed:[self karenPrefsBannerLoadFromImage] inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil];
NSString *suffix = @"";
if ([UIScreen mainScreen].bounds.size.height == 667.0) {
suffix = @"-667h";
} else if ([UIScreen mainScreen].bounds.size.height == 812.0) {
suffix = @"-812h";
}
bannerImage = [UIImage imageNamed:[[self karenPrefsBannerLoadFromImage] stringByAppendingString:suffix] inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] ?: bannerImage;
[self addSubview:[[UIImageView alloc] initWithImage:bannerImage]];
} else {
[self addSubview:[[UIImageView alloc] initWithImage:[UIImage imageNamed:[self karenPrefsBannerLoadFromImage] inBundle:[NSBundle bundleForClass:self.class]]]];
}
}
return self;
}
@end