25 #pragma mark - |
25 #pragma mark - |
26 @implementation UIScreen (safe) |
26 @implementation UIScreen (safe) |
27 |
27 |
28 -(CGFloat) safeScale { |
28 -(CGFloat) safeScale { |
29 CGFloat theScale = 1.0f; |
29 CGFloat theScale = 1.0f; |
30 if ([self respondsToSelector:@selector(scale)]) |
30 // if ([self respondsToSelector:@selector(scale)]) |
31 theScale = [self scale]; |
31 // theScale = [self scale]; |
32 return theScale; |
32 return theScale; |
33 } |
33 } |
34 |
34 |
35 -(CGRect) safeBounds { |
35 -(CGRect) safeBounds { |
36 CGRect original = [self bounds]; |
36 return [self bounds]; |
37 if (IS_ON_PORTRAIT()) |
37 // CGRect original = [self bounds]; |
38 return original; |
38 // if (IS_ON_PORTRAIT()) |
39 else |
39 // return original; |
40 return CGRectMake(original.origin.x, original.origin.y, original.size.height, original.size.width); |
40 // else |
|
41 // return CGRectMake(original.origin.x, original.origin.y, original.size.height, original.size.width); |
41 } |
42 } |
42 |
43 |
43 @end |
44 @end |
44 |
45 |
45 |
46 |
97 @implementation UIButton (quickStyle) |
98 @implementation UIButton (quickStyle) |
98 |
99 |
99 -(id) initWithFrame:(CGRect) frame andTitle:(NSString *)title { |
100 -(id) initWithFrame:(CGRect) frame andTitle:(NSString *)title { |
100 [self initWithFrame:frame]; |
101 [self initWithFrame:frame]; |
101 [self setTitle:title forState:UIControlStateNormal]; |
102 [self setTitle:title forState:UIControlStateNormal]; |
|
103 [self applyBlackQuickStyle]; |
|
104 |
|
105 return self; |
|
106 } |
|
107 |
|
108 - (void)applyBlackQuickStyle |
|
109 { |
102 [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
110 [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
103 [self setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted]; |
111 [self setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted]; |
104 self.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; |
112 self.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; |
105 self.backgroundColor = [UIColor blackColorTransparent]; |
113 self.backgroundColor = [UIColor blackColorTransparent]; |
106 |
114 |
107 [self.layer setBorderWidth:1]; |
115 [self.layer setBorderWidth:1.0f]; |
108 [self.layer setBorderColor:[[UIColor darkYellowColor] CGColor]]; |
116 [self.layer setBorderColor:[[UIColor darkYellowColor] CGColor]]; |
109 [self.layer setCornerRadius:9.0f]; |
117 [self.layer setCornerRadius:9.0f]; |
110 [self.layer setMasksToBounds:YES]; |
118 [self.layer setMasksToBounds:YES]; |
|
119 } |
111 |
120 |
112 return self; |
121 - (void)applyDarkBlueQuickStyle |
|
122 { |
|
123 [self setTitleColor:[UIColor darkYellowColor] forState:UIControlStateNormal]; |
|
124 [self setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted]; |
|
125 self.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; |
|
126 self.backgroundColor = [UIColor darkBlueColorTransparent]; |
|
127 |
|
128 [self.layer setBorderWidth:2.0f]; |
|
129 [self.layer setBorderColor:[[UIColor darkYellowColor] CGColor]]; |
|
130 [self.layer setCornerRadius:9.0f]; |
|
131 [self.layer setMasksToBounds:YES]; |
113 } |
132 } |
114 |
133 |
115 @end |
134 @end |
116 |
135 |
117 |
136 |