GithubHelp home page GithubHelp logo

shireeshms / ftpopovermenu_swift Goto Github PK

View Code? Open in Web Editor NEW

This project forked from liufengting/ftpopovermenu_swift

0.0 1.0 0.0 393 KB

FTPopOverMenu_Swift, swift version of FTPopOverMenu. FTPopOverMenu is a pop over menu for iOS which is maybe the easiest one to use. Supports both portrait and landscape. It can show from any UIView, any UIBarButtonItem and any CGRect.

License: MIT License

Swift 95.76% Ruby 2.94% Objective-C 1.30%

ftpopovermenu_swift's Introduction

FTPopOverMenu

Twitter Carthage compatible GitHub license Version Download CocoaPods GitHub stars

Swift version of FTPopOverMenu.

FTPopOverMenu

FTPopOverMenu is a pop over menu for iOS which is maybe the easiest one to use, supports both portrait and landscape. It can show from any UIView, any UIBarButtonItem and any CGRect. Simplest APIs, enable you to change the style in one line of code.

somtimes I want to customer every cell, so I seperate the global setting, and cell setting. e.g: my PM want some menu item are show but can't tap for some reason.

ScreenShots

screenshot

Installation

Manually

  • clone this repo.
  • Simply drag and drop the '/FTPopOverMenu_Swift/FTPopOverMenu.swift' file into your project.

CocoaPods

FTPopOverMenu_Swift is available through CocoaPods. To install it, simply add the following line to your Podfile:

  • Please use version >= Version
target 'MyApp' do
    pod 'FTPopOverMenu_Swift', '~> 0.0.6'
end

Then run a pod install inside your terminal, or from CocoaPods.app.

Usage

Customize

Do any of the following settings to set the style (Only set the ones you want to change), maybe do this when app starts or when you want it to show a different style, but remember it's global change.

    let configuration = FTConfiguration.shared
    configuration.menuRowHeight = ...
    configuration.menuWidth = ...
    configuration.textColor = ...
    configuration.textFont = ...
    configuration.tintColor = ...
    configuration.borderColor = ...
    configuration.borderWidth = ...
    configuration.textAlignment = ...
    configuration.ignoreImageOriginalColor = ...;
    // set 'ignoreImageOriginalColor' to YES, images color will be same as textColor

From SenderView, Menu Without Images.

        FTPopOverMenu.showForSender(sender: sender,
                                    with: ["Share"],
                                    done: { (selectedIndex) -> () in
                              
                                        print(selectedIndex)
        }) {
            
        }

From SenderView, Menu With Images.

        FTPopOverMenu.showForSender(sender: sender,
                                    with: ["Share"],
                                    menuImageArray: ["iconImageName"],
                                    done: { (selectedIndex) -> () in
                              
                                        print(selectedIndex)
        }) {
            
        }

From SenderFrame/NavigationItem, Menu Without Images.

        FTPopOverMenu.showFromSenderFrame(senderFrame: sender.frame,
                                          with: ["Share"],
                                          done: { (selectedIndex) -> () in
                                            
        }) {
            
        }

From SenderFrame/NavigationItem, Menu With Images.

        FTPopOverMenu.showFromSenderFrame(senderFrame: sender.frame,
                                          with: ["Share"],
                                          menuImageArray: ["iconImageName"],
                                          done: { (selectedIndex) -> () in
                                            
        }) {
            
        }

From barButtonItems .

  • First: add action with event to you barButtonItems
    @IBAction func handleAddBarButtonItem(_ sender: UIBarButtonItem, event: UIEvent) {
        
        FTPopOverMenu.showForEvent(event: event,
                                   with: ["Share"],
                                   menuImageArray: ["iconImageName"],
                                   done: { (selectedIndex) -> () in
        
        }) {
            
        }
    }

CHANGELOG

CHANGELOG

More

  • Swift version of FTPopOverMenu.
  • Logo Designed by @Tobaloidee
  • Images in the demo from https://www.iconfinder.com/iconsets/pokemon-go.
  • If you like it, or maybe wanna use it in your own projects, please give me a star.
  • Looking for another way of doing this? Take a look at my another FTPopMenu at here. It was another way of showing pop over menus, which is wrapped from UIPopoverViewController, and more genetic and more good-looking. Feel free to try it.

License

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

ftpopovermenu_swift's People

Contributors

liufengting avatar abdullahselek avatar tobaloidee avatar ilya-iks avatar dogo avatar ems305 avatar g00m avatar yizhi996 avatar chquanquan avatar

Watchers

James Cloos 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.