DTLocalNotification 1.0.0

DTLocalNotification 1.0.0

Tung Vo 维护。



  • tungvoduc

DTLocalNotification

Version License Platform

截图

 

用法

要在本地显示通知,必须在向展示者请求之前创建一个 DTLocalNotification 实例

let view = ExampleView(data: data)
let notification = DTLocalNotification(view: view)

DTLocalNotificationPresenter.shared.showNotification(notification, completion: nil)
let notification = CustomLocalNotificationViewController(data: data)

DTLocalNotificationPresenter.shared.showNotification(notification, completion: nil)

如您所见,有两种不同的方法来展示本地通知。第二种方法在您想在一个自定义的 DTNotificationViewController(自定义视图布局、状态栏样式、背景颜色等)中显示本地通知视图时通常更高效。


DTLocalNotificationPresenter 和 DTInteractiveLocalNotificationPresenter 是两个默认的展示者,用于展示通知。如果您想更改行为或动画,或者添加更多功能,只需从这两个类中继承一个并自行实现。

示例

要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install

需求

iOS 9.0+

安装

DTLocalNotification可以通过CocoaPods获取。安装它,只需在您的Podfile中添加以下行

pod 'DTLocalNotification'

作者

Tung Vo, [email protected]

许可

DTLocalNotification遵循MIT许可。更多信息请查看LICENSE文件。