GithubHelp home page GithubHelp logo

ftpopmenu's Introduction

FTPopMenu

FTPopMenu. It's wrapped from UIPopoverViewController. Here are screenshots of it. You are welcome to download this repo, and change the code all you want.

Usage

It provides two types of API to show menus.

Show from UIBarButtonItem

  • Extension in UIViewController+FTPopMenu.h
// Extension normal
- (IBAction)barBottonItemNormalAction:(UIBarButtonItem *)sender {

    [self showFTMenuFromBarButtonItem:sender
                            menuArray:[self menuStringArray]
                            doneBlock:^(NSInteger selectedIndex) {
                                
                            } cancelBlock:^{
                                
                            }];
}
// Extension custom
- (IBAction)barBottonItemCustomAction:(UIBarButtonItem *)sender {

    [self showFTMenuFromBarButtonItem:sender
                                title:@""
                            menuArray:[self menuStringArray]
                   menuImageNameArray:[self menuImageStringArray]
                        perferedWidth:200
                            rowHeight:60
                            tintColor:[UIColor blackColor]
                            doneBlock:^(NSInteger selectedIndex) {
                                
                            }cancelBlock:^{
                              
                          	}];
}                         
  • Class Methods in FTPopMenu.h
// Class Method normal
- (IBAction)barBottonItemNormalAction:(UIBarButtonItem *)sender {

    [FTPopMenu showFTMenuForViewController:self
                         fromBarButtonItem:sender
                                 menuArray:[self menuStringArray]
                                 doneBlock:^(NSInteger selectedIndex) {
                                     
                                 } cancelBlock:^{
                                     
                                 }];
}

// Class Method custom
- (IBAction)barBottonItemCustomAction:(UIBarButtonItem *)sender {

    [FTPopMenu showFTMenuForViewController:self
                         fromBarButtonItem:sender
                                     title:@"I am title"
                                 menuArray:[self menuStringArray]
                        menuImageNameArray:[self menuStringArray]
                             preferedWidth:200
                                 rowHeight:50
                                 tintColor:[UIColor blackColor]
                                 doneBlock:^(NSInteger selectedIndex) {
                                     
                                 }cancelBlock:^{
                                   
                               	}];
}

Show from UIView

  • Extension in UIViewController+FTPopMenu.h
// Extension normal
- (IBAction)buttonAction:(UIButton *)sender
{
    [self showFTMenuFromView:sender
                   menuArray:[self menuStringArray]
                   doneBlock:^(NSInteger selectedIndex) {
                       
                   }cancelBlock:^{
                       
                   }];
}
// Extension custom
- (IBAction)buttonAction:(UIButton *)sender
{
   [self showFTMenuFromView:sender
                      title:@""
                  menuArray:[self menuStringArray]
         menuImageNameArray:[self menuImageStringArray]
              perferedWidth:200
                  rowHeight:50
                  tintColor:[UIColor blackColor]
                  doneBlock:^(NSInteger selectedIndex) {
                      
                  }cancelBlock:^{
                      
                  }];
}                   
  • Class Methods in FTPopMenu.h
// Class Method normal
- (IBAction)buttonAction:(UIButton *)sender
{
    [FTPopMenu showFTMenuForViewController:self
                                  fromView:sender
                                 menuArray:[self menuStringArray]
                                 doneBlock:^(NSInteger selectedIndex) {
                                     
                                 } cancelBlock:^{
                                     
                                 }];

}

// Class Method custom
- (IBAction)buttonAction:(UIButton *)sender
{
   [FTPopMenu showFTMenuForViewController:self
                                 fromView:sender
                                    title:@"I am Title"
                                menuArray:[self menuStringArray]
                       menuImageNameArray:[self menuStringArray]
                            preferedWidth:200
                                rowHeight:60
                                tintColor:[UIColor blackColor]
                                doneBlock:^(NSInteger selectedIndex) {
                                    
                                }cancelBlock:^{
                                  
                              	}];
}

Maybe you want use FTPopOverMenu instead of FTPopMenu. It has more simple APIs.

License

FTPopMenu is available under the MIT license. See the LICENSE file for more info.

ftpopmenu's People

Contributors

liufengting avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.