GSMessages 1.7.5

GSMessages 1.7.5

测试已测试
Lang语言 SwiftSwift
许可 MIT
Released最后发布2021年10月
SPM支持 SPM

GeSen 维护。



  • Gesen

GSMessages

演示

示例

要显示通知,请使用以下代码

self.showMessage("Something success", type: .success)

要在视图中显示通知

view.showMessage("Something success", type: .success)

要手动隐藏通知

self.hideMessage()

选项(当前设置为默认值)

  • type : success / error / warning / info
  • animation : slide(.normal) / slide(.distance(50)) / fade
  • position : top / bottom
  • textAlignment : topLeft / topCenter / topRight / left / center / right / bottomLeft / bottomCenter / bottomRight
self.showMessage("String or NSAttributedString", type: .success, options: [
    .accessibilityIdentifier(nil),
    .animations([.slide(.normal)]),
    .animationDuration(0.3),
    .autoHide(true),
    .autoHideDelay(3.0),
    .cornerRadius(0.0),
    .height(44.0),
    .hideOnTap(true),
    .handleTap({}),
    .isInsideSafeAreaInsets(true),
    .margin(.zero),
    .padding(.init(top: 10, left: 30, bottom: 10, right: 30)),
    .position(.top),
    .textAlignment(.center),
    .textColor(.white),
    .textNumberOfLines(1),
])

字体 / 背景颜色

以下是通过以下方式设置自定义字体和背景颜色的方法

GSMessage.font = UIFont.boldSystemFont(ofSize: 14)
GSMessage.successBackgroundColor = UIColor(red: 142.0/255, green: 183.0/255, blue: 64.0/255,  alpha: 0.95)
GSMessage.warningBackgroundColor = UIColor(red: 230.0/255, green: 189.0/255, blue: 1.0/255,   alpha: 0.95)
GSMessage.errorBackgroundColor   = UIColor(red: 219.0/255, green: 36.0/255,  blue: 27.0/255,  alpha: 0.70)
GSMessage.infoBackgroundColor    = UIColor(red: 44.0/255,  green: 187.0/255, blue: 255.0/255, alpha: 0.90)

需求

主功能

  • iOS 8.0+
  • Xcode 11+ (Swift 5.x)

1.7.1

  • iOS 8.0+
  • Xcode 10.0+ (Swift 4.2)

1.5.1

  • iOS 8.0+
  • Xcode 9.0+ (Swift 4.0)

1.3.5

  • iOS 8.0+
  • Xcode 8.0+ (Swift 3.x)

1.2.4

  • iOS 7.0+
  • Xcode 7.3+ (Swift 2.x)

安装

CocoaPods

在您的 Podfile

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod "GSMessages"

以及您的 *.swift

import GSMessages

Carthage

在您的 Cartfile

github "wxxsw/GSMessages"

以及您的 *.swift

import GSMessages

许可证

GSMessages遵循MIT许可协议。有关更多信息,请参阅LICENSE文件。