Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Change NavigationBar's color and transparency 导航栏颜色渐变,通过给viewController添加属性,可方便控制title、item、导航栏颜色变化

License

Notifications You must be signed in to change notification settings

MQZHot/MTransparentNav

Repository files navigation

MTransparentNav

Change NavigationBar's color and transparency

导航栏滑动渐变

Usage

In the need to change the color of the controller

self.navAlpha = 0;
self.navTintColor = [UIColor whiteColor];
self.navTitleColor = [UIColor whiteColor];
self.navBackgroundColor = [UIColor greenColor];

You can change nav tintColor and barTintColor in UIScrollViewDelegate

-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
 CGFloat y = scrollView.contentOffset.y;
 self.navAlpha = y / 80;
 if (y > 80) {
 self.navTitleColor = self.navTintColor = [UIColor redColor];
 } else {
 self.navTitleColor = y < 0 ? [UIColor clearColor] : [UIColor whiteColor];
 self.navTintColor = y < 0 ? [UIColor clearColor] : [UIColor whiteColor];
 }
}

Install

  • pod 'TransparentNav'

  • #import "TransparentNav.h"

Related articles

iOS导航栏滑动渐变

Author

LICENSE

MTransparentNav is released under the MIT license. See LICENSE for details.

About

Change NavigationBar's color and transparency 导航栏颜色渐变,通过给viewController添加属性,可方便控制title、item、导航栏颜色变化

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /