项目介绍:
StatusBarNotification
DEMO 直接下载:
Installation
CocoaPods:
not support
Manually:
- Drag the DBStatusBarNotification/DBStatusBarNotification folder into your project.
- Add #include "StatusBarNotification.h", where you want to use it
Usage
StatusBarNotification is a singleton. You don’t need to initialize it anywhere.Just use the following class methods:
Showing a notification
[Objective-C] 查看源文件 复制代码
class func showWithStatus(status: String) -> UIView? class func showWithStatus(status: String, timeInterval: NSTimeInterval) -> UIView?
The return value will be the notification view. You can just ignore it, but if you need further customization, this is where you can access the view.
Dismissing a notification
class func dismiss()
class func dismissAfter(delay: NSTimeInterval)
Showing progress
[Objective-C] 查看源文件 复制代码
class func showProgress(progress: CGFloat) // Range: 0.0 - 1.0
Showing activity
[Objective-C] 查看源文件 复制代码
class func showActivityIndicator(show: Bool, style:UIActivityIndicatorViewStyle)
Showing a notification with alternative styles
Included styles:
Use them with the following methods:
[Objective-C] 查看源文件 复制代码
class func showWithStatus(status: String, styleName: String) -> UIView? class func showWithStatus(status: String, timeInterval: NSTimeInterval, styleName: String) -> UIView?
To present a notification using a custom style, use the identifier you specified in addStyleNamed:prepare:. See Customization below.
Customization
[Objective-C] 查看源文件 复制代码
class func setDefaultStyle(prepareBlock: PrepareStyleBlock?) class func addStyleNamed(identifier: String, prepareBlock:PrepareStyleBlock) -> String {
The prepareBlock gives you a copy of the default style, which can be modified as you like:
[Objective-C] 查看源文件 复制代码
StatusBarNotification.addStyleNamed(<#identifier#>) { (style) -> StatusBarStyle in // main properties style!.barColor = <#color#> style!.textColor = <#color#> style!.font = <#font#> // advanced properties style.animationType = <#type#>; style.textShadow = <#shadow#>; style.textVerticalPositionAdjustment = <#adjustment#>; // progress bar style.progressBarColor = <#color#>; style.progressBarHeight = <#height#>; style.progressBarPosition = <#position#>; return style! }
Animation Types
- None
- Move
- Bounce
- Fade
Progress Bar Positions
- Bottom
- Center
- Top
- Below
- NavBar