CWNotificationBanner 0.2.2

CWNotificationBanner 0.2.2

测试已测试
Lang语言 SwiftSwift
许可证 MIT
发布最新发布2016年11月
SPM支持 SPM

Charlie Williams 维护。



CWNotificationBanner

您需要一个好看的 iOS 推送通知 UI 来显示弹窗吗?这里就是。

  • 支持队列消息:新消息会立即显示,然后随着消息过期或被撤销,NotificationBanner 会自动向后移动。
  • 支持取消单个消息或一次性取消所有消息。
import CWNotificationBanner

override func viewDidLoad() {
    super.viewDidLoad()

    // MessageAction to register blocks by key to call when tapping a message banner
    let tapAction:MessageAction = { Void in

    let alert = UIAlertController(title: "Tapped the alert banner", message: "Popups are a terrible user experience, eh?", preferredStyle: .Alert)
    self.showViewController(alert, sender: nil)
    }

    Message.registerAction(tapAction, forKey: "tapAction")
}

override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)

    let message = Message(text: "Hello there")

    NotificationBanner.showMessage(message)
}

override func viewWillDisappear() {
    super.viewWillDisappear()

    NotificationBanner.cancelMessage(message, animated: false)
    NotificationBanner.cancelAllMessages()
}

CWNotificationBanner 是对 AGPushNote(《https://github.com/avielg/AGPushNote》)的 Swift 2.0 再解释。

未来的改进

  • 改善文档
  • 改善示例应用
  • 实现对于弹窗显示的自定义设定

使用方法

要运行示例项目,先克隆仓库,然后在 Example 目录下运行 pod install

需求

SwiftyTimer

安装

CWNotificationBanner 可通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中

pod "CWNotificationBanner"

作者

Charlie Williams, [email protected] / @buildsucceeded

许可证

CWNotificationBanner 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。