Skip to content

Commit

Permalink
Merge pull request #9 from sternhenri/master
Browse files Browse the repository at this point in the history
Avoid Overlapping RKDropdownAlerts
  • Loading branch information
cwRichardKim committed Feb 9, 2015
2 parents 2cf4186 + 8fe343a commit c3b8129
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions SlingshotDropdownAlert/RKDropdownAlert.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ extern NSString *const RKDropdownAlertDismissAllNotification;

@protocol RKDropdownAlertDelegate <NSObject>
-(BOOL)dropdownAlertWasTapped:(RKDropdownAlert*)alert;
-(BOOL)dropdownAlertWasDismissed;
@end

@interface RKDropdownAlert : UIButton
Expand Down Expand Up @@ -67,6 +68,7 @@ extern NSString *const RKDropdownAlertDismissAllNotification;

@property UIColor *defaultViewColor;
@property UIColor *defaultTextColor;
@property BOOL isShowing;
@property id<RKDropdownAlertDelegate> delegate;

-(void)title:(NSString*)title message:(NSString*)message backgroundColor:(UIColor*)backgroundColor textColor:(UIColor*)textColor time:(NSInteger)seconds;
Expand Down
7 changes: 7 additions & 0 deletions SlingshotDropdownAlert/RKDropdownAlert.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ - (id)initWithFrame:(CGRect)frame
selector:@selector(dismissAlertView)
name:RKDropdownAlertDismissAllNotification
object:nil];
self.isShowing = NO;

}
return self;
Expand Down Expand Up @@ -122,6 +123,10 @@ -(void)removeView:(UIButton *)alertView
{
if (alertView){
[alertView removeFromSuperview];
self.isShowing = NO;
if (self.delegate){
[self.delegate dropdownAlertWasDismissed];
}
}
}

Expand Down Expand Up @@ -292,6 +297,8 @@ -(void)title:(NSString*)title message:(NSString*)message backgroundColor:(UIColo
}
}

self.isShowing = YES;

[UIView animateWithDuration:ANIMATION_TIME animations:^{
CGRect frame = self.frame;
frame.origin.y = 0;
Expand Down

0 comments on commit c3b8129

Please sign in to comment.