Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pheuter/mfexpandablemenu
An expandable menu for iOS with transitions and styling
https://github.com/pheuter/mfexpandablemenu
Last synced: 3 months ago
JSON representation
An expandable menu for iOS with transitions and styling
- Host: GitHub
- URL: https://github.com/pheuter/mfexpandablemenu
- Owner: pheuter
- License: mit
- Created: 2014-03-31T02:24:37.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-12T13:16:39.000Z (over 10 years ago)
- Last Synced: 2024-09-12T21:47:37.215Z (4 months ago)
- Language: Objective-C
- Homepage:
- Size: 198 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# MFExpandableMenu
[![Version](http://cocoapod-badges.herokuapp.com/v/MFExpandableMenu/badge.png)](http://cocoadocs.org/docsets/MFExpandableMenu)
MFExpandableMenu is an expandable menu for iOS 7 with transitions and styling.
- Automatically lighten menu items given base color
- Simple delegation leveraging UICollectionView under the hood
- Customizable fonts and colors
- Render any UIView as the menu item "detail view"## Installation
MFExpandableMenu is available through [CocoaPods](http://cocoapods.org), to install
it simply add the following line to your Podfile:pod "MFExpandableMenu", "~> 0.0.1"
## Demo
You can find the sample project in **Example/Demo**
![DemoGif](https://dl.dropboxusercontent.com/u/1803181/ExpandableMenuGif.gif)
## Usage
Displaying menu containing 4 items
- `MFExpandableMenuDataSource` - Used to determine amount and content of items in the menu
- `MFExpandableMenuDelegate` - Provides callbacks when menu items are selected```objective-c
#import@interface ViewController : UIViewController
```In the implementation:
```objective-c
MFExpandableMenuViewController *menuViewController = [[MFExpandableMenuViewController alloc] init];// Custom background fade color
menuViewController.customBackgroundFadeColor = [UIColor purpleColor];// Assign dataSource and delegate properties
menuViewController.dataSource = self;
menuViewController.delegate = self;// Show the menu
[self presentViewController:menuViewController animated:YES completion:nil];
```Required `dataSource` methods:
```objective-c
- (NSInteger)numberOfItemsInMenuViewController:(MFExpandableMenuViewController *)menuViewController {
return 4;
}- (NSString *)menuViewController:(MFExpandableMenuViewController *)menuViewController
titleForMenuItemAtIndex:(NSInteger)index1 {
return [NSString stringWithFormat:@"Menu Item %d", index1 + 1];
}- (UIView *)menuViewController:(MFExpandableMenuViewController *)menuViewController
detailViewForMenuItemAtIndex:(NSInteger)index1 {
return someUIView;
}
```Optional `delegate` methods:
```objective-c
- (void) menuViewController:(MFExpandableMenuViewController *)menuViewController
willShowDetailViewForMenuItemAtIndex:(NSInteger)index {
NSLog(@"Showing detail view for menu item at index: %i", index);
}- (void) menuViewController:(MFExpandableMenuViewController *)menuViewController
willHideDetailViewForMenuItemAtIndex:(NSInteger)index {
NSLog(@"Hiding detail view for menu item at index: %i", index);
}
```## Customization
The following `MFExpandableMenuViewController` properties can be customized:
- `UIFont *customMenuItemFont` - The font to use for the menu item labels
- `UIColor *customMenuItemTextColor` - The color to use for the menu item labels
- `UIColor *customBackgroundFadeColor` - The color to use for the initial menu item background color that will automatically lighten across subsequent items## Testing
To run the unit test suite:
$ cd Example
$ make install
$ make ci## Author
Mark Fayngersh, [email protected]
## License
MFExpandableMenu is available under the MIT license. See the LICENSE file for more info.