答案 0 :(得分:0)
在这里,您是一个可以在应用程序通知中自定义的库:
https://github.com/hyperoslo/Whisper
安装
Whisper可以通过CocoaPods获得。要安装它,只需将以下行添加到Podfile:
pod 'Whisper'
用法
组件的使用非常简单,你只需要在Whisper的情况下创建一条消息,在Shout的情况下发布消息,或者在Whistle的情况下创建一个Murmur,它是这样完成的:
对于一个耳语:
let message = Message(title: "Enter your message here.", backgroundColor: UIColor.redColor())
// Show and hide a message after delay
show(whisper: message, to: navigationController, action: .Show)
// Present a permanent message
show(whisper: message, to: navigationController, action: .Present)
// Hide a message
hide(whisperFrom: navigationController)
对于喊叫:
let announcement = Announcement(title: "Your title", subtitle: "Your subtitle", image: UIImage(named: "avatar"))
show(shout: announcement, to: navigationController, completion: {
print("The shout was silent.")
})