NotchyAlert
必备条件
- Xcode 9.x
- Swift 4.x
- iPhone X 模拟器/设备
演示
安装
Cocoapods
要使用Cocoapods安装NotchyAlert,请将以下行添加到Podfile中
pod 'NotchyAlert'
Carthage
要使用Carthage安装NotchyAlert,请将以下行添加到您的Cartfile中
github "TheAbstractDev/NotchyAlert"
使用方法
首先,您需要导入NotchyAlert
import NotchyAlert
仅标题
let notchy = Notchy(title: "Oops!", description: nil, image: nil)
notchy.presentNotchy(in: self.view, duration: 3)
标题和描述
let notchy = Notchy(title: "Oops!", description: "No Internet Connection.", image: nil)
notchy.presentNotchy(in: self.view, duration: 3)
标题和图片
let notchy = Notchy(title: "Oops!", description: nil, image: "<YOUR IMAGE>)
notchy.presentNotchy(in: self.view, duration: 3)
标题、描述和图片
let notchy = Notchy(title: "Oops!", description: "No Internet Connection.", image: "<YOUR IMAGE>)
notchy.presentNotchy(in: self.view, duration: 3)
弹跳效果
默认情况下,弹跳效果为true。您可以通过在调用
notchy.presentNotchy(in: self.view, duration: 3, bounce: false)
示例
您可以通过下载并运行 Notchy 项目来测试它。
许可
NotchyAlert 适用于 MIT 许可。有关更多信息,请参阅 LICENSE 文件。