微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ASToast Toast 风格的消息提示

程序名称:ASToast

ASToast 介绍

ASToast 是一个用 Swift 写成的扩展,用于制作 Android Toast 风格的通知。

使用示例:

// 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()

ASToast 官网

https://github.com/abdullahselek/ASToast

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐