Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/BernardGatt/iOSPullDownMenu
A pulldown menu designed for all iOS devices, it supports both navigation controllers and views, users can either pull it down or activate by tapping a button.
https://github.com/BernardGatt/iOSPullDownMenu
Last synced: about 2 months ago
JSON representation
A pulldown menu designed for all iOS devices, it supports both navigation controllers and views, users can either pull it down or activate by tapping a button.
- Host: GitHub
- URL: https://github.com/BernardGatt/iOSPullDownMenu
- Owner: BernardGatt
- License: mit
- Created: 2013-08-08T12:22:36.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-04-16T19:41:56.000Z (over 7 years ago)
- Last Synced: 2024-07-20T11:06:26.144Z (2 months ago)
- Language: Objective-C
- Homepage:
- Size: 111 KB
- Stars: 127
- Watchers: 11
- Forks: 24
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
iOSPullDownMenu
===============A pulldown menu for all iOS devices.
The pulldown menu supports both navigation controllers and views, users can either pull it down or activate by tapping a button.
### To connect the pulldown menu to the navigation controller
.h
```objective-c
#import "PulldownMenu.h"@interface MasterNavigationController : UINavigationController {
PulldownMenu *pulldownMenu;
}@property (nonatomic, retain) PulldownMenu *pulldownMenu;
@end
```.m
```objective-c
- (void)viewDidLoad
{
[super viewDidLoad];
pulldownMenu = [[PulldownMenu alloc] initWithNavigationController:self];
[self.view insertSubview:pulldownMenu belowSubview:self.navigationBar];
[pulldownMenu insertButton:@"Menu Item 1"];
[pulldownMenu insertButton:@"Menu Item 2"];
[pulldownMenu insertButton:@"Menu Item 3"];pulldownMenu.delegate = self;
[pulldownMenu loadMenu];
}
```### Or connect the pulldown menu to a view instead of the navigation controller.
.h
```objective-c
#import "PulldownMenu.h"@interface MainViewController : UIViewController {
PulldownMenu *pulldownMenu;
}
```.m
```objective-c
- (void)viewDidLoad
{
[super viewDidLoad];pulldownMenu = [[PulldownMenu alloc] initWithView:self.view];
[self.view addSubview:pulldownMenu];[pulldownMenu insertButton:@"Menu Item 1"];
[pulldownMenu insertButton:@"Menu Item 2"];
[pulldownMenu insertButton:@"Menu Item 3"];pulldownMenu.delegate = self;
[pulldownMenu loadMenu];
}- (IBAction)menuTap:(id)sender {
[pulldownMenu animateDropDown];
}
```### Events fired by the Pulldown Menu
The component fires 2 events, #1 when a menu item is selected and #2 when the pull down is fully animated.```objective-c
-(void)menuItemSelected:(NSIndexPath *)indexPath
{
NSLog(@"%d",indexPath.item);
}-(void)pullDownAnimated:(BOOL)open
{
if (open)
{
NSLog(@"Pull down menu open!");
}
else
{
NSLog(@"Pull down menu closed!");
}
}
```### Open / Close on demand
The pull down/up animation can be called on demandFrom a view inside a navigation controller:
```objective-c
[((MasterNavigationController *)self.navigationController).pulldownMenu animateDropDown];
```From a view
```objective-c
[pulldownMenu animateDropDown];
```### Styles
Apart from having both table view and handle exposed, a number of styling properties are available out of the box.```objective-c
cellHeight = 60;
handleHeight = 15;
animationDuration = 0.3f;
topMarginPortrait = 0;
topMarginLandscape = 0;
cellColor = [UIColor grayColor];
cellSelectedColor = [UIColor blackColor];
cellFont = [UIFont fontWithName:@"GillSans-Bold" size:19.0f];
cellTextColor = [UIColor whiteColor];
cellSelectionStyle = UITableViewCellSelectionStyleDefault;
```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/BernardGatt/iospulldownmenu/trend.png)](https://bitdeli.com/free "Bitdeli Badge")