GTNotification 1.4.3

GTNotification 1.4.3

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2015年9月
SPM支持SPM

King-Wizard维护。



GTNotification

Swift的本地通知横幅。

使用Cocoapods进行设置(推荐设置)

  • 将以下说明添加到您的Podfile中
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

pod 'GTNotification', '>= 1.4'
  • 然后在您的Swift类顶部添加import GTNotification

  • 最后编译并运行,您就可以开始了。

否则,您还可以手动导入框架

只需将'GTNotification/*.swift文件拖入您的Xcode项目,并确保勾选“如果需要则复制项”以及“添加到目标”部分中的相应的复选框。

示例

// Initialize a notification
let notification: GTNotification = GTNotification()
notification.title = "Welcome Notification"
notification.message = "Thank you for checking out GTNotificationView."
notification.position = GTNotificationPosition.Top
notification.animation = GTNotificationAnimation.Slide
notification.blurEnabled = true

// Perform a custom selector on tap
notification.addTarget(self, action: Selector("dismissNotification"))

// Set the notification's delegate
notification.delegate = self

// Show the notification
GTNotificationManager.sharedInstance.showNotification(notification)

GTNotification代理方法

// MARK: GTNotificationDelegate Methods

func notificationDidDismiss(notification: GTNotification)
{
    // The notification was dismissed automatically
    NSLog("The notification was dismissed automatically")
}

func notificationFontForTitleLabel(notification: GTNotification) -> UIFont
{
    return UIFont(name: "AvenirNext-Medium", size: 16.0)!
}

func notificationFontForMessageLabel(notification: GTNotification) -> UIFont
{
    return UIFont(name: "AvenirNext-Regular", size: 13.0)!
}

截图

暗模糊

Dark Blur Notification

明模糊

Light Blur Notification

超亮模糊

Extra Light Blur Notification

纯色

Solid Color Notification