Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 41 lines (30 sloc) 0.87 kB
3c163ec @soffes * Improved landscape support in SSRatingPickerViewController
soffes authored
1 //
2 // UIScreen+SSToolkitAdditions.m
3 // SSToolkit
4 //
5 // Created by Sam Soffes on 2/4/11.
6 // Copyright 2011 Sam Soffes. All rights reserved.
7 //
8
9 #import "UIScreen+SSToolkitAdditions.h"
10
11 @implementation UIScreen (SSToolkitAdditions)
12
13 - (CGRect)currentBounds {
ffcf0ad @steipete fixes enum conversion warnings
steipete authored
14 return [self boundsForOrientation:[[UIApplication sharedApplication] statusBarOrientation]];
3c163ec @soffes * Improved landscape support in SSRatingPickerViewController
soffes authored
15 }
16
17
18 - (CGRect)boundsForOrientation:(UIInterfaceOrientation)orientation {
19 CGRect bounds = [self bounds];
b771775 @alaborie Added a method to know if a screen is a retina display.
alaborie authored
20
3c163ec @soffes * Improved landscape support in SSRatingPickerViewController
soffes authored
21 if (UIInterfaceOrientationIsLandscape(orientation)) {
22 CGFloat buffer = bounds.size.width;
b771775 @alaborie Added a method to know if a screen is a retina display.
alaborie authored
23
3c163ec @soffes * Improved landscape support in SSRatingPickerViewController
soffes authored
24 bounds.size.width = bounds.size.height;
25 bounds.size.height = buffer;
26 }
27 return bounds;
28 }
29
b771775 @alaborie Added a method to know if a screen is a retina display.
alaborie authored
30 - (BOOL)isRetinaDisplay {
31 static dispatch_once_t predicate;
32 static BOOL answer;
33
f44e277 @soffes Fixed Xcode 4.1 issues and added SSToolkit in the prefix of SSCatalog
soffes authored
34 dispatch_once(&predicate, ^{
b771775 @alaborie Added a method to know if a screen is a retina display.
alaborie authored
35 answer = ([self respondsToSelector:@selector(scale)] && [self scale] == 2);
36 });
37 return answer;
38 }
39
3c163ec @soffes * Improved landscape support in SSRatingPickerViewController
soffes authored
40 @end
Something went wrong with that request. Please try again.