Skip to content

khaled-zayed/PopMenu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PopMenu

PopMenu is a simple library that implements a pop out menu.

PopMenu

The menu pops out around the menu button and the user simply drags his finger to the menu item of his choice.

When the user's finger is dragged over a menu item the button is enlarged. If the user removes his finger from the screen outside the borders of all menu items the menu closes.

The menu is simple, fast and user friendly.

##Get Started

  • Download PopMenu and try the bundled example project
  • Read the README file or the documentation below

##Installing PopMenu

  • Just add the files in PopMenu folder to your project

##How to use PopMenu include the PopMenu.h to your ViewController and implement PopMenu Delegate

#import "PopMenu.h"

@interface ViewController : UIViewController <PopMenuDelegate>

###Declare PopMenu Object

#import "ViewController.h"

@interface ViewController (){
    PopMenu *popMenu;
}

###Initializing PopMenu

  • Declare UIButtons in your ViewConroller
  • Create NSArray with menuItems Buttons
    NSArray *menuItemsArray = [[NSArray alloc]initWithObjects:facebookButton, instagramButton, twitterButton, nil]; //create NSArray with the menu items ordered from left to right
  • Initialize PopMenu Object
    popMenu = [[PopMenu alloc]initWithMenuButton:shareButton menuItems:menuItemsArray]; //initialize PopMenu
  • Specify PopMenu Delegate
popMenu.delegate = self; //specify delegate
  • Implement REQUIRED delegate method
-(void)menuItemPressed:(UIButton *)button{
    //required - returns the button the user selected
    if (button == facebookButton) {
        NSLog(@"Facebook Selected");
    }
    else if (button == instagramButton) {
        NSLog(@"Instagram Selected");
    }
    else if (button == twitterButton) {
        NSLog(@"Twitter Selected");
    }
    
}

##Optional Delegate Methods:

-(void)menuPressed{
    //optional - do something when user presses on the menu button
}
-(void)popMenuCancelled{
    //optional - do something when user cancels menu
}
-(void)fingerDragged:(CGPoint)currentPoint{
    //optional - track user finger
}

###Developed By Khaled Zayed contactme@khaledzayed.com

About

PopMenu is a simple library that implements a pop out menu.

Resources

License

Stars

Watchers

Forks

Packages

No packages published