Android-style menu animations for iOS
animatedButtonPosition : position of the screen. Available options are: ALAnimatedButtonPositionBottomRight, ALAnimatedButtonPositionBottomLeft, ALAnimatedButtonPositionTopRight, ALAnimatedButtonPositionTopLeft
animatedButtonVerticalMargin : vertical margin (in pixels) from the closes superview vertical point animatedButtonHorizontalMargin : horizontal margin (in pixels) from the closes superview horizontal point
animatedButtonAlphaNormal : Alpha-channel of menu button in the normal state (default 1) animatedButtonAlphaOpened : Alpha-channel of menu button in opened state (default 0.5) animatedButtonRadius : Radius from main button to menu buttons (default 110) animatedButtonHideMenuOnButtonClick : Should menu be hidden after click? (default YES)
Create control with constructor initWithImage:(UIImage *) buttonImage inView:(UIView *) parentView; Add menu buttons calling method addMenuButton:(UIImage *) buttonImage withTag:(NSInteger) buttonTag Add ALAnimatedButtonWithMenuDelegate to your class and set animatedButtonDelegate property.
Example:
#import "ALAnimatedButtonWithMenu.h"
@interface ViewController () <ALAnimatedButtonWithMenuDelegate>
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
ALAnimatedButtonWithMenu * menuButton = [[ALAnimatedButtonWithMenu alloc] initWithImage:[UIImage imageNamed:@"button_plus"] inView:self.view];
[menuButton addMenuButton:[UIImage imageNamed:@"button_1"] withTag:1];
[menuButton addMenuButton:[UIImage imageNamed:@"button_2"] withTag:2];
[menuButton addMenuButton:[UIImage imageNamed:@"button_3"] withTag:3];
[menuButton setAnimatedButtonDelegate:self];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - ALAnimatedButtonWithMenuDelegate
- (void) animatedMenuButtonSelected:(ALAnimatedButtonWithMenu *)animatedButtonWithMenu buttonTag:(NSInteger)buttonTag {
NSLog(@"Menu button tapped: %d", (int) buttonTag);
}
#Additional methods
Available methods:
- (void) displayMenu;
- (void) hideMenu;
For manual menu opening and closing