Closed khuong291 closed 7 years ago
@krodak , can you please provide swift syntax of below method.
[JDStatusBarNotification addStyleNamed:<#identifier#> prepare:^JDStatusBarStyle(JDStatusBarStyle style) {
// 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;
}];
I am tring lot but do not get success. kindly help me to out. Thanks
enum StatusBarStyles : String {
case Success
case Failure
case Uploading
}
//MARK: Styles
class func setupCustomStyles() {
JDStatusBarNotification.addStyleNamed(StatusBarStyles.Success.rawValue) { (style) -> JDStatusBarStyle! in
style.barColor = .cp__successBackground()
style.textColor = .cp__successFontColor()
style.font = UIFont.latoRegular(12.0)
style.textShadow = nil
style.animationType = .Bounce
return style
}
JDStatusBarNotification.addStyleNamed(StatusBarStyles.Uploading.rawValue) { (style) -> JDStatusBarStyle! in
style.barColor = .redColor()
style.textColor = .whiteColor()
style.font = UIFont.latoRegular(12.0)
style.textShadow = nil
style.animationType = .Move
style.progressBarColor = .whiteColor()
style.progressBarHeight = CGFloat(1.0)
style.progressBarPosition = .Bottom
return style
}
JDStatusBarNotification.addStyleNamed(StatusBarStyles.Failure.rawValue) { (style) -> JDStatusBarStyle! in
style.barColor = .redColor()
style.textColor = .whiteColor()
style.font = UIFont.latoRegular(12.0)
style.textShadow = nil
style.animationType = .Bounce
return style
}
}
It's Swift 2.3 as I don't have anything more up to date, but you should be fine :+1:
@krodak, Thanks for your update. it will save my too many hours. thanks once again.
Works perfectly for me.