Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added animating condition to prevent too much taps

  • Loading branch information...
commit 306132a76bce198508c241e07e4f6fff24dd194b 1 parent 9238b37
@levey authored
View
BIN  ...xcodeproj/project.xcworkspace/xcuserdata/Levey.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown
View
2  AwesomeMenu/AwesomeMenu/AwesomeMenu.h
@@ -20,7 +20,7 @@
AwesomeMenuItem *_addButton;
id<AwesomeMenuDelegate> _delegate;
-
+ BOOL _isAnimating;
}
@property (nonatomic, copy) NSArray *menusArray;
@property (nonatomic, getter = isExpanding) BOOL expanding;
View
10 AwesomeMenu/AwesomeMenu/AwesomeMenu.m
@@ -117,7 +117,6 @@ - (UIImage*)contentImage {
return _addButton.contentImageView.image;
}
-
- (void)setHighlightedContentImage:(UIImage *)highlightedContentImage {
_addButton.contentImageView.highlightedImage = highlightedContentImage;
}
@@ -131,6 +130,11 @@ - (UIImage*)highlightedContentImage {
#pragma mark - UIView's methods
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
+ // if the menu is animating, prevent touches
+ if (_isAnimating)
+ {
+ return NO;
+ }
// if the menu state is expanding, everywhere can be touch
// otherwise, only the add button are can be touch
if (YES == _expanding)
@@ -241,7 +245,6 @@ - (BOOL)isExpanding
}
- (void)setExpanding:(BOOL)expanding
{
-
if (expanding) {
[self _setMenu];
}
@@ -263,6 +266,7 @@ - (void)setExpanding:(BOOL)expanding
// Adding timer to runloop to make sure UI event won't block the timer from firing
_timer = [[NSTimer timerWithTimeInterval:timeOffset target:self selector:selector userInfo:nil repeats:YES] retain];
[[NSRunLoop currentRunLoop] addTimer:_timer forMode:NSRunLoopCommonModes];
+ _isAnimating = YES;
}
}
#pragma mark - private methods
@@ -271,6 +275,7 @@ - (void)_expand
if (_flag == [_menusArray count])
{
+ _isAnimating = NO;
[_timer invalidate];
[_timer release];
_timer = nil;
@@ -313,6 +318,7 @@ - (void)_close
{
if (_flag == -1)
{
+ _isAnimating = NO;
[_timer invalidate];
[_timer release];
_timer = nil;
Please sign in to comment.
Something went wrong with that request. Please try again.