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 master
pod install
Import MMActionSheet in you code
import MMActionSheet
Manual import
Just clone and add components dir to your project.
Example
Cancel
buttons andTitle
【有标题和取消按钮】
Cancel
button but noTitle
【无标题有取消按钮】
Cancel
button and noTitle
【无标题无取消按钮】
Title
but noCancel
button【有标题无取消按钮】
【自定义文本颜色】
【自定义背景色、选中背景色等】
【多数据滚动】
【设置顶部圆角】
Usage
PS:注释
MMActionSheet(title: titleItem, buttons: buttons, duration: nil, cancelButton: cancelButton)
title
头部标题,类型为MMTitleItem
buttons
事件按钮数组,类型为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.