Skip to content

Commit 94cb1ac

Browse files
committed
Clean up
1 parent 820f716 commit 94cb1ac

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

MMDrawerController/MMDrawerBarButtonItem.m

+16-20
Original file line numberDiff line numberDiff line change
@@ -172,23 +172,23 @@ -(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{
172172
[self setNeedsDisplay];
173173
}
174174

175-
- (void)setSelected:(BOOL)selected{
175+
-(void)setSelected:(BOOL)selected{
176176
[super setSelected:selected];
177177
[self setNeedsDisplay];
178178
}
179179

180-
- (void)setHighlighted:(BOOL)highlighted{
180+
-(void)setHighlighted:(BOOL)highlighted{
181181
[super setHighlighted:highlighted];
182182
[self setNeedsDisplay];
183183
}
184184

185-
- (void)setTintColor:(UIColor *)tintColor{
185+
-(void)setTintColor:(UIColor *)tintColor{
186186
if([super respondsToSelector:@selector(setTintColor:)]){
187187
[super setTintColor:tintColor];
188188
}
189189
}
190190

191-
- (void)tintColorDidChange{
191+
-(void)tintColorDidChange{
192192
[self setNeedsDisplay];
193193
}
194194

@@ -201,9 +201,9 @@ @interface MMDrawerBarButtonItem ()
201201

202202
@implementation MMDrawerBarButtonItem
203203

204-
+ (UIImage*) drawerButtonItemImage{
204+
+(UIImage*)drawerButtonItemImage{
205205

206-
static UIImage* drawerButtonImage = nil;
206+
static UIImage *drawerButtonImage = nil;
207207
static dispatch_once_t onceToken;
208208
dispatch_once(&onceToken, ^{
209209

@@ -240,11 +240,11 @@ + (UIImage*) drawerButtonItemImage{
240240

241241
-(id)initWithTarget:(id)target action:(SEL)action{
242242

243-
if ( [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 ){
244-
return [self initWithImage: [self.class drawerButtonItemImage]
245-
style: UIBarButtonItemStylePlain
246-
target: target
247-
action: action];
243+
if((floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1)){
244+
return [self initWithImage:[self.class drawerButtonItemImage]
245+
style:UIBarButtonItemStylePlain
246+
target:target
247+
action:action];
248248
}
249249
else {
250250
MMDrawerMenuButtonView * buttonView = [[MMDrawerMenuButtonView alloc] initWithFrame:CGRectMake(0, 0, 26, 26)];
@@ -260,20 +260,16 @@ -(id)initWithTarget:(id)target action:(SEL)action{
260260
}
261261

262262
-(id)initWithCoder:(NSCoder *)aDecoder{
263-
264263
// non-ideal way to get the target/action, but it works
265-
UIBarButtonItem* bbi = [[UIBarButtonItem alloc] initWithCoder: aDecoder];
266-
267-
return [self initWithTarget: bbi.target action: bbi.action];
264+
UIBarButtonItem* barButtonItem = [[UIBarButtonItem alloc] initWithCoder: aDecoder];
265+
return [self initWithTarget:barButtonItem.target action:barButtonItem.action];
268266
}
269267

270268
-(void)touchUpInside:(id)sender{
271269

272270
#pragma clang diagnostic push
273-
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
274-
275-
[self.target performSelector: self.action withObject: self];
276-
271+
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
272+
[self.target performSelector:self.action withObject:sender];
277273
#pragma clang diagnostic pop;
278274

279275
}
@@ -294,7 +290,7 @@ -(void)setShadowColor:(UIColor *)color forState:(UIControlState)state{
294290
[self.buttonView setShadowColor:color forState:state];
295291
}
296292

297-
- (void)setTintColor:(UIColor *)tintColor{
293+
-(void)setTintColor:(UIColor *)tintColor{
298294
if([super respondsToSelector:@selector(setTintColor:)]){
299295
[super setTintColor:tintColor];
300296
}

0 commit comments

Comments
 (0)