A foreground notification banner library, easy to use and customizable.
- Provide Success, Info, Warning, Error, and Custom banner type.
- Adapt itself to the device orientation.
- Handle click event.
- iOS 8.0+
- Xcode 8.0+ Swift 3
Check out Get Started tab on cocoapods.org.
To use NotificationBanner in your project add the following 'Podfile' to your project
pod 'NotificationBanner', '~> 1.0.4’
Then run:
pod install
Copy the NotificationBanner Directory to your project. Go ahead and import NotificationBanner to your file.
- Sample:
import NotificationBanner
class ViewController: UIViewController, NotificationBannerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
//Show NotificationBanner
showNotificationBanner(bannerStyle: .successMessage, bannerLocation: .Top,
messageTitle: "Success", messageContent: "This is a Success notification")
}
//NotificationBanner click event(required)
func notificationBannerClick(_ view: NotificationBannerView) {
//Dissmiss NotificationBanner
dissmissBanner(completion: { Sucess in _ = Bool()
if(Sucess){
}
}
)
}
}
You can configure NotificationBanner properties.
- NotificationBanner style(Success, Info, Warning, Error, and Custom banner type)*
bannerStyle: .successMessage //Success style
bannerStyle: .infoMessage //Info style
bannerStyle: .warningMessage //Warning style
bannerStyle: .errorMessage //Error style
bannerStyle: .customView //Custom style
- NotificationBanner location on the view
bannerLocation: .Top //Top
bannerLocation: .Bottom //Bottom
- NotificationBanner title message
messageTitle: String //title message
- NotificationBanner content message
messageContent: String //content message
- NotificationBanner title string font
messageTitleFont: CGFloat //title string font, default is 25
- NotificationBanner content string font
messageContentFont: CGFloat //content string font, default is 15
- NotificationBanner Height
bannerHeight: Int //banner height, default is 80
- NotificationBanner hold time(second)
bannerHoldTime: Int //banner hold time, default is 5 sec
- If your bannerStyle is .customView(Custom style), you can configure bannerBackgroundColor and bannerImage properties
bannerBackgroundColor: UIColor //banner background color
bannerImage: UIImage //banner icon image
NotificationBanner is available under the MIT License.
Copyright © 2016 Joe.