Toast 風格的消息提示:ASToast

jopen 9年前發布 | 18K 次閱讀 ASToast Android開發 移動開發

ASToast 是一個用 Swift 寫成的擴展,用于制作 Android Toast 風格的通知。

Toast 風格的消息提示:ASToast

使用示例:

// make a toast with single text
self.view.makeToast("Single text toast")
// make a toast with text, title, position and duration
self.view.makeToast("Toast with custom text, title and duration", duration: NSTimeInterval(3.0), 
    position: ASToastPosition.ASToastPositionCenter.rawValue, title: "Title")
// Make toast with an image
self.view.makeToast("Toast with an image", duration: NSTimeInterval(3.0), 
    position: ASToastPosition.ASToastPositionTop.rawValue, image: UIImage(named: "apple_logo"))
// Show a custom view as toast
var customView: UIView! = UIView(frame: CGRectMake(0.0, 0.0, 200.0, 300.0))
customView.autoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin | 
    UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin
customView.backgroundColor = UIColor.greenColor()
self.view.showToast(customView, duration: NSTimeInterval(3.0), position: ASToastPosition.ASToastPositionCenter.rawValue)
// Show activity indicator
self.view.makeToastActivity()

項目主頁:http://www.baiduhome.net/lib/view/home/1434418379145

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!