MMActionSheet
一个简单的 actionSheet 选择控件,防止微信底部 sheet 弹出框弹出。支持自定义颜色
导入方法
-
使用 CocoaPods 导入
在文件
Podfile
中加入以下内容:pod 'MMActionSheet-Swift', '~> 0.1.0'
然后运行以下命令:
pod install 或 pod update
-
手动导入
复制工程中 MMActionSheet 文件夹下的 MMActionSheet.swift 文件即可
使用
- 使用默认的颜色方案
let items = ["拍照","相册"]
let sheet = MMActionSheet(title: "选择", items: items)
sheet.handelChooseAction { (index) in
print("选择了---\(items[index])")
}
sheet.handelCancelAction {
print("取消选择")
}
-
自定义颜色
let item1 = MMActionSheetItem(title: "查看", color: UIColor.black) let item2 = MMActionSheetItem(title: "删除", color: UIColor.red) let items = [item1,item2] let sheet = MMActionSheet(title: "选择", items: items) sheet.handelChooseAction { (index) in print("选择了---\(index)") } sheet.handelCancelAction { print("取消选择") }