MMShareSheet介绍(自定义的分享弹出框组件)
来源:互联网 发布:51单片机论坛hex 编辑:程序博客网 时间:2024/06/10 13:34
MMShareSheet
Introduction
MMShareSheet 是一个简单的弹出选择框,使用纯swift编写,类似于微信(或支付宝)里面的分享(朋友圈打开网页右上角分享)控件
MMShareSheet is an simple pop-up selection box(ShareSheet) written in pure Swift. Similar to the wechat(or airpay) actionsheet share-UIKit
Rquirements
- iOS 8.0+
- Xcode 9 (swift 4)
- Xcode 8 (swift 3)
- If you want to run demo in swift3, please switch branch to swift3.0
Installation
Install with Cocoapods
pod 'MMShareSheet', '~> 1.0'
import MMShareSheet
in you code
Copy code into project
克隆代码,然后将components文件夹下面的两个文件 MMShareSheet.swift
和 MMCardItem.swift
加入到你的项目中即可。
Just clone and add MMShareSheet.swift
, MMCardItem.swift
to your project.
Example
【类似于微信分享】- Similar to WeChat share
【单组cards】- Single group cards(显示组数完全取决于传入的cards数组)
【多组cards】- Multi group cards
【支持远程icon】- Support remote Icon
Usage
let cards = [ [ [ "title": "微信好友", "icon": "wechat", "handler": "wxfriend" ],[ "title": "微信朋友圈", "icon": "moment", "handler": "wxmoment" ],[ "title": "QQ好友", "icon": "qq", "handler": "qqfriend", ],[ "title": "支付宝", "icon": "airpay", "handler": "airpay", ],[ "title": "新浪微博", "icon": "sina", "handler": "sinawb", ] ],[ [ "title": "拷贝", "icon": "copy_link", "handler": "copy" ],[ "title": "在Safari中打开", "icon": "safari", "handler": "safari" ],[ "title": "收藏", "icon": "collection", "handler": "collect", ],[ "title": "刷新", "icon": "refresh_icon", "handler": "refresh", ],[ "title": "举报", "icon": "jubao", "handler": "report", ] ]]let cancelBtn = [ "title": "取消", "handler": "cancel", "type": "default",]let mmShareSheet = MMShareSheet.init(title: "此网页由wx.keeponrunning.com提供", cards: cards, duration: nil, cancelBtn: cancelBtn)mmShareSheet.callBack = { (handler) ->() in print(handler)}mmShareSheet.present()
PS:注释
- create sharesheet && init 【创建并初始化】
MMShareSheet.init(title: "此网页由wx.keeponrunning.com提供", cards: cards, duration: nil, cancelBtn: cancelBtn)
argument【参数描述】
title
头部标题cards
事件按钮数组,类型为Array<Array<Dictionary<String, String>>>
,里面包含每一行卡片组Array<Dictionary<String, String>>
,每一行卡片里面又包含item
mmShareSheet.callBack = { (handler) ->() in print(handler)}
handler
该handler即为cards里面item的handler
,对应的回调过来
- present【弹出sharesheet】
mmShareSheet.present()
Contacts
Github: MinMao-Hub
Email: 1286090267@qq.com
希望喜欢的朋友们给小星星哦☆【star】
- MMShareSheet介绍(自定义的分享弹出框组件)
- MMActionSheet介绍(自定义的UIActionSheet弹出框组件)
- Flex AIR自定义Mobile的弹出框组件
- Flex 自定义组件 -- 弹出窗口 [PopUpManager TitleWindow 组件]的使用
- Flex 自定义组件 -- 弹出窗口 [PopUpManager TitleWindow 组件]的使用
- iOS自定义分享 (一)分享组件的接入
- BottomDialog 一个自定义的从底部弹出的 dialog,仿照微博的分享弹框
- Android之自定义Dialog弹出框公共组件类
- React Native自定义组件——弹出框
- react-native自定义对话框弹出框组件dialogs
- 自定义的弹出框类
- 自定义的消息弹出框
- 自定义弹出框的位置
- (原创)分享一个自定义的tablayout组件
- 分享一个超好用的圆形imageview自定义组件
- android 分享弹出框
- 底部弹出框分享
- 弹出框组件
- OpenCV3_C++_DetectEye()图像眼睛识别 实例
- plotly 笔记
- A
- NOIP2017(值得祭奠)提高组初赛记
- STM32F105使用固件库的时候串口乱码解决方法
- MMShareSheet介绍(自定义的分享弹出框组件)
- fiddler 使用技巧
- ES6中的promise
- python数据处理
- WIN 设备遍历
- OpenCV3_C++_Akaze()图像的特征点提取 实例
- strcpy 和 memcpy 区别
- Linux操作系统 习题一
- Git中的常用命令