https://github.com/tinymind/lsfloatingactionmenu
LSFloatingActionMenu is floating action button component of material design for iOS.
https://github.com/tinymind/lsfloatingactionmenu
Last synced: 9 months ago
JSON representation
LSFloatingActionMenu is floating action button component of material design for iOS.
- Host: GitHub
- URL: https://github.com/tinymind/lsfloatingactionmenu
- Owner: tinymind
- License: mit
- Created: 2016-04-18T12:08:47.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-06-05T13:56:34.000Z (over 9 years ago)
- Last Synced: 2025-04-14T04:22:32.842Z (10 months ago)
- Language: Objective-C
- Size: 233 KB
- Stars: 36
- Watchers: 5
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LSFloatingActionMenu
LSFloatingActionMenu is floating action button component of material design for iOS.
## ScreenShot

## Installation
### Add source code to project
Add [LSFloatingActionMenu](https://github.com/tinymind/LSFloatingActionMenu/tree/master/LSFloatingActionMenuDemo/LSFloatingActionMenuDemo/LSFloatingActionMenu) to your XCode project.
### CocoaPods
```
pod 'LSFloatingActionMenu', '~> 1.0.0'
```
## Usage
``` objc
#import "LSFloatingActionMenu.h"
- (IBAction)onTopLeftButtonClicked:(UIButton *)sender {
[self showMenuFromButton:sender withDirection:LSFloatingActionMenuDirectionUp];
}
- (void)showMenuFromButton:(UIButton *)button withDirection:(LSFloatingActionMenuDirection)direction {
button.hidden = YES;
NSArray *menuIcons = @[@"icon_menu_add", @"icon_menu_unlock", @"icon_menu_kick", @"icon_menu_user", @"icon_menu_mic", @"icon_menu_lock"];
NSMutableArray *menus = [NSMutableArray array];
CGSize itemSize = button.frame.size;
for (NSString *icon in menuIcons) {
LSFloatingActionMenuItem *item = [[LSFloatingActionMenuItem alloc] initWithImage:[UIImage imageNamed:icon] highlightedImage:[UIImage imageNamed:[icon stringByAppendingString:@"_highlighted"]]];
item.itemSize = itemSize;
[menus addObject:item];
}
self.actionMenu = [[LSFloatingActionMenu alloc] initWithFrame:self.view.bounds direction:direction menuItems:menus menuHandler:^(LSFloatingActionMenuItem *item, NSUInteger index) {
//TODO
} closeHandler:^{
[self.actionMenu removeFromSuperview];
self.actionMenu = nil;
button.hidden = NO;
}];
self.actionMenu.itemSpacing = 12;
self.actionMenu.startPoint = button.center;
[self.view addSubview:self.actionMenu];
[self.actionMenu open];
}
```