测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布日期上次发布 | 2017年9月 |
Swift版本Swift版本 | 3.0 |
SPM支持SPM | ✗ |
由 qiuncheng 维护。
注意:如果要让状态栏风格发生变化,必须在 info.plist
中将 View controller-based status bar appearance
设置为 NO
。
Swift 3.0 & iOS 8+
如何使用?例如:-> NoticeBarAnimationType.info
/// title : The message you want to show
/// defaultType : Above four types with different style above.
let noticeBar = NoticeBar(title: "#message", defaultType:.info)
/// duration : How long the noticeBar will stay. And it will dismiss automatically.
/// completed :optional. When the noticeBar dismissed, what you want to do, nothing type nil.
noticeBar.show(duration: #TimeInterval, completed: { (#Bool) in
})
NoticeBarConfig
NoticeBarConfig 会管理 NoticeBar 的 title
,默认为 nil
,需要时 image
,默认文本颜色为 UIColor.black
,默认背景颜色为 UIColor.white
,animationType
默认从 NoticeBarAnimationType.top
开始,barStyle
默认为 NoticeBarStyle.onNavigationBar
,margin
默认为 10.0
,这将决定 image
和 title
之间的空间,以及 NoticeBar 左侧和 image
之间的空间。
如何使用?例如
/// NoticeBarConfig : There are some other NoticeBarConfig init, it's up to you which to use.
let config = NoticeBarConfig(title: "#message you want to show.", image: #image, textColor: UIColor.white, backgroundColor: UIColor.red, barStyle: NoticeBarStyle.onNavigationBar, animationType: NoticeBarAnimationType.top )
let noticeBar = NoticeBar(config: config)
/// do something before noticeBar show.
/// such as : UIApplication.shared.statusBarStyle = .lightContent
noticeBar.show(duration: 2.0, completed: {
(finished) in
if finished {
/// do something here.
/// such as : UIApplication.shared.statusBarStyle = .default
}
})
在 MIT 许可证 下。
版权所有 © 2016 QiunCheng. 保留所有权利。