UIMenuScroll 0.1.0

UIMenuScroll 0.1.0

Aleksey Pleshkov 维护。



UIMenuScroll

UIMenuScroll 创建菜单方式类似于 Facebook Messenger 的拍照菜单

Screenshot

安装

CocoaPods 是 Cocoa 项目的依赖管理器。您可以使用以下命令安装它

$ gem install cocoapods

要使用 CocoaPods 将 UIMenuScroll 集成到您的 Xcode 项目中,请在您的 Podfile 中指定它

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
pod 'UIMenuScroll', '~> 0.1.0'
end

然后,运行以下命令

$ pod install

如何使用

将 UIView 添加到 Storyboard 中,并将类设置为 UIMenuScrollView
在您的 ViewController 中为 UIMenuScrollView 添加代理

@IBOutlet weak var menuScroll: UIMenuScrollView!

// ...

override func viewDidLoad() {
    super.viewDidLoad()
    // ...
    
    // MenuScroll configuration
    menuScroll.delegate = self
    menuScroll.spacing = 10.0
    
    // ...
}

然后为 ViewController 创建扩展

extension ViewController: UIMenuScrollViewDelegate {

    /// Set count a elements in menu scroll
    func menuScroll(menuScroll: UIMenuScrollView) -> Int
    { ... }

    /// Set options to single button on menu scroll
    func menuScroll(menuScroll: UIMenuScrollView, createdButton: UIButton, index: Int) 
    { ... }

    /// Touch button event
    func menuScroll(menuScroll: UIMenuScrollView, touchSender: UIButton, index: Int) 
    { ... }

    /// Set options to center indicator image
    func menuScroll(menuScroll: UIMenuScrollView) -> UIImage?
    { ... }

}

关于我

许可证

UIMenuScroll采用MIT许可证发布。简而言之,它是无需付费的,但你必须在代码或软件分发中保留版权声明。