一年多之前因为某个个人项目,同时也是为了实验一下KVO,做了一个序列化显示提示消息的cocoapod库。
当时只是为了App原型里用,并没有太多考虑美观和易用性什么的(反正就自己用,想这么多作甚)
最近把它用到了自己现在开发中的项目里,就发现简陋得有些和界面格格不入。加上Swift也更到了4.2,之前的有些代码也要稍作调整。于是干脆趁着这周手头的工作没那么忙碌,把DZPopupMessageView翻新了一下。
- cocoapods上的地址
https://cocoapods.org/pods/DZPopupMessageView
使用方法:
引入
import DZPopupMessageView
调用
/// paramters
/// - message text: String
/// - theme: DZPopupMessage.Theme(enum)
/// 可以为nil,默认为 .light
/// - type: DZPopupMessage.MessageType(enum)
/// 可以为nil,默认为 .info
/// - display: DZPopupMessage.DisplayType(enum)
/// 可以为nil,默认为 .bubbleTop
DZPopupMessage.show({msg text}, theme: {theme}, type: {type}, display: {display}, callback: {
// 回调方法
})
参数
- theme
- DZPopupMessage.Theme.light
- DZPopupMessage.Theme.dark
- type
- DZPopupMessage.MessageType.info
- DZPopupMessage.MessageType.warning
- DZPopupMessage.MessageType.error
- display
- DZPopupMessage.DisplayType.rise
- DZPopupMessage.DisplayType.drop
- DZPopupMessage.DisplayType.bubbleTop
- DZPopupMessage.DisplayType.bubbleBottom
各种重载
DZPopupMessage.show("Message body");
DZPopupMessage.show({msg text}, theme: {theme}, type: {type}, display: {display});
DZPopupMessage.show({msg text}, theme: {theme}, type: {type});
...