MMActionSheet介绍(自定义的UIActionSheet弹出框组件)
来源:互联网 发布:中世纪2优化9教皇国 编辑:程序博客网 时间:2024/06/05 08:23
MMActionSheet
Introduction
MMActionSheet 是一个简单的弹出选择框,使用纯swift编写,类似于微信的actionsheet
MMActionSheet is an simple pop-up selection box(ActionSheet) written in pure Swift. Similar to the wechat actionsheet
Rquirements
- iOS 8.0+
- Xcode 9 (swift 4)
- current code keep on swift4
- Xcode 8 (swift 3)
- If you want to run demo in swift3, please switch branch to swift3.0
Installation
① Cocoapods
pod 'MMActionSheet', '~> 0.0.5'
import MMActionSheet
in you code
② Copy code into project
克隆代码,然后将components文件夹下面的两个文件 MMActionSheet.swift
和 MMButton.swift
加入到你的项目中即可。
Just clone and add MMActionSheet.swift
, MMButton.swift
to your project.
Example
1、 has “Cancel” buttons and titles【有标题有取消按钮】
2、 has a “Cancel” button but no title【无标题有取消按钮(类似于微信)】
3、 no “Cancel” button and no title【无标题无取消按钮】
4、 has a title but no “Cancel” button【有标题无取消按钮】
5、 Defines the title color【定义标题颜色】
目前仅支持三种(default
,blue
,danger
)
Usage
let buttons = [ [ "title": "拍照", "handler": "camera", ],[ "title": "相册", "handler": "photos", "type": "default" ]] let mmActionSheet = MMActionSheet.init(title: "请选择照片", buttons: buttons, duration: nil, cancel: true)mmActionSheet.callBack = { (handler) ->() in print(handler)}mmActionSheet.present()
PS:注释
- create actionsheet && init 【创建并初始化】
MMActionSheet.init(title: "请选择照片", buttons: buttons, duration: nil, cancel: true)
argument【参数描述】
title
头部标题buttons
事件按钮数组,类型为Array<Dictionary<String, String>>
,里面包含每一个按钮的具体属性:[ "title": "拍照", "handler": "camera", "type": "default"]
title
按钮标题handler
按钮事件唯一标识,回调的时候根据该值区别处理事件type
按钮类型(展示不同的标题颜色)【default
,blue
,danger
】
duration
动画时长cancel
是否需要取消按钮
- callback【回调】
mmActionSheet.callBack = { (handler) ->() in print(handler)}
handler
该handler即为buttons里面button的handler
,对应的回调过来
- present【弹出actionsheet】
mmActionSheet.present()
Contacts
Github–https://github.com/MinMao-Hub
Email:1286090267@qq.com
- MMActionSheet介绍(自定义的UIActionSheet弹出框组件)
- MMShareSheet介绍(自定义的分享弹出框组件)
- Flex AIR自定义Mobile的弹出框组件
- iphone 弹出表单UIActionSheet的应用。
- Flex 自定义组件 -- 弹出窗口 [PopUpManager TitleWindow 组件]的使用
- Flex 自定义组件 -- 弹出窗口 [PopUpManager TitleWindow 组件]的使用
- 自定义UIActionSheet
- 自定义UIActionSheet
- UIActionsheet 自定义
- 自定义UIActionSheet
- 自定义UIActionSheet
- 自定义UIActionSheet
- 介绍UIALertView和UIActionSheet的用法。
- 介绍UIALertView和UIActionSheet的用法。
- 介绍UIALertView和UIActionSheet的用法。
- 使用UIActionSheet 弹出UIDatePicker
- UIActionSheet 弹出时箭头
- UIActionSheet 弹出UIDatePicker
- <10/11>打卡随笔
- 跨域SSO单点登录的简易实现和代理服务
- What is Gas Limit in Ethereum?
- 如何设计数据库(数据库设计原则)
- 密码编码学与网络安全problem 4.7
- MMActionSheet介绍(自定义的UIActionSheet弹出框组件)
- 测试之道--网络爬虫系列4(http协议请求实战)
- python中关于统计相关计算的库和函数
- 分布式系统的session共享问题
- 怎样在Android_Studio里面使用Gradle构建
- install texlive-full on ubuntu
- 172. Factorial Trailing Zeroes
- RAC初识--003--RACRACDisposable
- springmvc学习笔记