Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MGTileMenu/MGTileMenuController.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
@property (nonatomic, strong) UIImage *pageButtonImage; // default: nil (which renders an ellipsis "...")
@property (nonatomic) BOOL shouldMoveToStayVisibleAfterRotation; // whether the menu should automatically move to remain fully visible after the device has been rotated (default: YES)
@property (nonatomic) BOOL closeButtonVisible; // whether the close button is visible (default: YES). If NO, the user can still dismiss the menu by tapping outside its bounds (which you can also disable via the tileMenuShouldDismiss: delegate method)
@property (nonatomic) BOOL enableTapDragOnEllipsis;// enables the user to tap and drag on Ellipsis button to move the Menu View


// Creation.
Expand Down
37 changes: 37 additions & 0 deletions MGTileMenu/MGTileMenuController.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ @implementation MGTileMenuController
@synthesize pageButtonImage = _pageButtonImage;
@synthesize shouldMoveToStayVisibleAfterRotation = _shouldMoveToStayVisibleAfterRotation;
@synthesize closeButtonVisible = _closeButtonVisible;
@synthesize enableTapDragOnEllipsis = _enableTapDragOnEllipsis;


#pragma mark - Creation and destruction
Expand Down Expand Up @@ -112,6 +113,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
nil];

_singlePageMaxTiles = NO;
_enableTapDragOnEllipsis = NO;
}
return self;
}
Expand Down Expand Up @@ -211,6 +213,15 @@ - (void)loadView
UIImage *tileHighlightedImage = [self tileBackgroundImageHighlighted:YES];
[tileButton setBackgroundImage:tileImage forState:UIControlStateNormal];
[tileButton setBackgroundImage:tileHighlightedImage forState:UIControlStateHighlighted];

//enable tap and drag on ellipsis button to move the menu
if( _enableTapDragOnEllipsis )
{
//listen to drag events on ellipsis button
UIPanGestureRecognizer *dragGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(tapDrag:)];
[tileButton addGestureRecognizer:dragGesture];
}

} else {
j = [[_animationOrder objectAtIndex:i] integerValue];
if (_rightHanded) {
Expand Down Expand Up @@ -1113,4 +1124,30 @@ - (void)goToNextPage
}


- (void)tapDrag:(UIPanGestureRecognizer*)panGesture
{
if( panGesture.state == UIGestureRecognizerStateEnded )
{
//drag end - so reset the highlight
[(UIButton*)panGesture.view setHighlighted:NO];
}
else
{
//drag start or in movement
[(UIButton*)panGesture.view setHighlighted:YES];

CGPoint tranlation = [panGesture translationInView:self.view];
CGRect menuViewFrame = self.view.frame;
menuViewFrame.origin.x += tranlation.x;
menuViewFrame.origin.y += tranlation.y;

//we ensure that the menu does fully overlap ( contains within ) the outer rect
menuViewFrame = MGMinimallyOverlapRects(menuViewFrame, _parentView.bounds,MG_PARENTVIEW_EDGE_INSET );
[self.view setFrame:menuViewFrame];

//reset the translation as we have read the value
[panGesture setTranslation:CGPointZero inView:self.view];
}
}

@end
2 changes: 2 additions & 0 deletions MGTileMenu/MLGViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ - (void)handleGesture:(UIGestureRecognizer *)gestureRecognizer
if (!tileController) {
// Create a tileController.
tileController = [[MGTileMenuController alloc] initWithDelegate:self];
//lets enable the tap drag feature
tileController.enableTapDragOnEllipsis = YES;
tileController.dismissAfterTileActivated = NO; // to make it easier to play with in the demo app.
}
// Display the TileMenu.
Expand Down