BasicToast 是一个在视图上显示基本 Toast 提示框的库。
要运行示例项目,请克隆此仓库,然后首先从 Example 目录运行 pod install
。
//
// ViewController.swift
// BasicToast
//
// Created by 62205797 on 06/16/2022.
// Copyright (c) 2022 62205797. All rights reserved.
//
import UIKit
import BasicToast
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func topTabbed(_ sender: Any) {
if #available(iOS 13.0, *) {
BasicToast.show(self: self, message: "this is a top toast", duration: 3.0, position: .top)
} else {
// Fallback on earlier versions
}
}
@IBAction func middleTabbed(_ sender: Any) {
if #available(iOS 13.0, *) {
BasicToast.show(self: self, message: "this is a middle toast", duration: 3.0, position: .middle)
} else {
// Fallback on earlier versions
}
}
@IBAction func bottomTabbed(_ sender: Any) {
if #available(iOS 13.0, *) {
BasicToast.show(self: self, message: "this is a bottom toast", duration: 3.0, position: .bottom)
} else {
// Fallback on earlier versions
}
}
}
BasicToast.show(self: UIViewController, message: String, duration: TimeInterval = 5.0, position: pos = .bottom, font: UIFont = UIFont.systemFont(ofSize: 14.0))
BasicToast 可以通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中
pod 'BasicToast'
62205797, hyeoncheolkim96@gmail.com
BasicToast 基于 MIT 许可证发布。有关更多信息,请参见 LICENSE 文件。