public var title: String?
public var titleColor: MMButtonTitleColor? = .default
public var titleFont: UIFont? = .systemFont(ofSize: 16.0)
public var buttonType: MMButtonType?
public var backgroudImageColorNormal: MMButtonTitleColor? = .custom(MMTools.DefaultColor.normalColor)
public var backgroudImageColorHighlight: MMButtonTitleColor? = .custom(MMTools.DefaultColor.highlightColor)
title 按钮标题
titleColor 按钮颜色
titleFont 按钮字体
type 按钮类型(展示不同的标题颜色)【枚举类型 - default,blue,danger, custom】
mmActionSheet.selectionClosure = { item in
if let currentItem = item, let type = currentItem.buttonType {
switch type {
case let .default(index):
print("== default index \(index) ==")
case .cancel:
print("cancel")
}
}
}
item 该handler即为buttons里面的MMButtonItem,对应的回调过来
present【弹出actionsheet】
mmActionSheet.present()
Contribution
You are welcome to fork and submit pull requests.
License
MMActionSheet is open-sourced software licensed under the MIT license.
Introduction
MMActionSheet 是一个简单的弹出选择框,使用纯swift编写,类似于微信的actionsheet
MMActionSheet is an simple pop-up selection box(ActionSheet) written in pure Swift. Similar to the wechat actionsheet
Rquirements
Installation
Swift Package Manager
To install with Swift Package Manager, add this package to your project’s ‘Swift Packages’ section. Or add the following line to your Package.swift:
Install with Cocoapods
To install MMActionSheet using CocoaPods, integrate it in your existing Podfile, or create a new Podfile:
Execute command:
pod repo update masterpod installImport MMActionSheet in you code
import MMActionSheetManual import
Just clone and add components dir to your project.
Example
Cancelbuttons andTitle【有标题和取消按钮】
Cancelbutton but noTitle【无标题有取消按钮】
Cancelbutton and noTitle【无标题无取消按钮】
Titlebut noCancelbutton【有标题无取消按钮】
【自定义文本颜色】
【自定义背景色、选中背景色等】
【多数据滚动】
【设置顶部圆角】
Usage
PS:注释
MMActionSheet(title: titleItem, buttons: buttons, duration: nil, cancelButton: cancelButton)title头部标题,类型为MMTitleItembuttons事件按钮数组,类型为Array<MMButtonItem>,里面包含每一个按钮的具体属性:title按钮标题titleColor按钮颜色titleFont按钮字体type按钮类型(展示不同的标题颜色)【枚举类型 -default,blue,danger,custom】backgroudImageColorNormal正常背景色backgroudImageColorHighlight选中背景色duration动画时长cancelBtn取消按钮属性,属性跟上述buttons内部button属性一致;若设置为nil则不显示该按钮item该handler即为buttons里面的MMButtonItem,对应的回调过来mmActionSheet.present()Contribution
You are welcome to fork and submit pull requests.
License
MMActionSheet is open-sourced software licensed under the MIT license.