ETNavBarTransparent: Swift 实现导航栏平滑的显示和隐藏翻译 / 编辑

最近提交:4月前
创建时间:2017.03.07

语言构成

Swift96.2%
Ruby3.8%

README

ETNavBarTransparent

Change NavigationBar's transparency at pop gestrue and other situation

Animation

image

Installation

Add the following line to your Podfile:

pod 'ETNavBarTransparent'

Then, run the following command:

$ pod install

Or, simply drag ETNavBarTransparent.swift to your project.

Usage

Change NavigationBar's transparency and tintColor where you want:

// Example:
// Change in viewDidLoad
override func viewDidLoad() {
    super.viewDidLoad()

    self.navBarBgAlpha = 0
    self.navBarTintColor = .white
}

// Change in scrollView scroll
func scrollViewDidScroll(_ scrollView: UIScrollView) {

    if scrollView.contentOffset.y > 100 {
        navBarBgAlpha = 1
        navBarTintColor = UIColor.defaultNavBarTintColor()
    } else {
        navBarBgAlpha = 0
        navBarTintColor = .white
    }

}

Related articles

导航栏的平滑显示和隐藏 - 个人页的自我修养(1)

License

MIT license. See LICENSE for details.

Contact

Follow and contact me on Weibo @日光镇 or My Blog

讨论区

说说你的看法