ASToastToast 风格的消息提示
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()
评论