-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUIDeviceExtension.m
More file actions
42 lines (30 loc) · 890 Bytes
/
UIDeviceExtension.m
File metadata and controls
42 lines (30 loc) · 890 Bytes
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
37
38
39
40
41
42
//
// UIDeviceExtension.m
//
// Licensed by ruralcoder.com under the
// Creative Commons Attribution-ShareAlike 3.0 Unported License
#import "UIDeviceExtension.h"
static const CGSize KStandardListViewCellImageSize = {40, 40};
static const CGSize KRetinaListViewCellImageSize = {80, 80};
@implementation UIDevice (Extension)
+ (BOOL) isRetinaDisplay
{
if ( [UIScreen instancesRespondToSelector:@selector(scale)] == NO)
return NO;
return ([[UIScreen mainScreen] scale] == 2.0);
}
+ (CGSize) imageSizeForCell
{
if ([UIDevice isRetinaDisplay])
return KRetinaListViewCellImageSize;
else
return KStandardListViewCellImageSize;
}
+ (NSString *) newUniqueIdentifier
{
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFStringRef string = CFUUIDCreateString(NULL, theUUID);
CFRelease(theUUID);
return (NSString *)string;
}
@end