YFPopupButtons 0.1.2

YFPopupButtons 0.1.2

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2016年8月
SPM支持 SPM

yangfan 维护。



  • 作者:
  • pushian

YFPopupButtons

Demo Gif

示例

要运行示例项目,请克隆仓库,并首先从 Example 目录运行 pod install

安装

YFPopupButtons 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod "YFPopupButtons"

如何使用

初始化

var testView = YFPopupButtonsView()
testView.delegate = self

核心功能

  • 显示按钮视图并弹出按钮。
testView.show()
  • 销毁按钮视图和按钮。通常,用户不需要在自己的代码中调用此函数,因为视图中已经内置了销毁动作。
testView.dismiss()

代理函数

  • 显示按钮的总数。
func numOfItems(buttonsView: YFPopupButtonsView) -> Int
  • 指示单行中允许显示的最大按钮数。
func maxNumberOfItemsInRow(buttonsView: YFPopupButtonsView) -> Int
  • 定义所有按钮的大小。
func itemSize(buttonsView: YFPopupButtonsView) -> CGSize
  • 初始化并自定义按钮。
func buttonsView(buttonsView: YFPopupButtonsView, itemForIndex index: Int) -> YFPopupbotton

定义带图像和标题的圆形按钮的示例。

func buttonsView(buttonsView: YFPopupButtonsView, itemForIndex index: Int) -> YFPopupbotton {
    let button = YFPopupbotton(contentImage: UIImage(named: "fbIcon")!, title: "Title")
    button.contentImageView.layer.cornerRadius = 30
    button.contentImageView.backgroundColor = .whiteColor()
    button.contentImageView.contentMode = .ScaleAspectFill
    return button
}
  • 自定义点击某些按钮时触发的事件。
func buttonsView(buttonsView: YFPopupButtonsView, didTapItemAtIndex index: Int)
  • 定义最左侧按钮/最右侧按钮和视图之间的空间。
func sideMargin(buttonsView: YFPopupButtonsView) -> CGFloat
  • 定义按钮两行之间的空间。
func spaceBetweenRows(buttonsView: YFPopupButtonsView) -> CGFloat
  • 自定义按钮显示之前的动作。
func buttonsViewWillAppear(buttonsView: YFPopupButtonsView)
  • 自定义按钮被销毁后的动作。
func buttonsViewWillDisappear(buttonsView: YFPopupButtonsView)

作者

pushian,[email protected]

许可证

YFPopupButtons 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。