Coder Social home page Coder Social logo

huanglins / vhlnavigation Goto Github PK

View Code? Open in Web Editor NEW
213.0 3.0 26.0 33.47 MB

导航栏切换之颜色过渡切换,导航栏背景图片切换,微信红包两种不同颜色切换,导航栏透明度,有无导航栏切换

License: MIT License

Objective-C 95.02% Ruby 0.41% Swift 4.57%
navigationbar navigation wechat ios ios11 iphone-x

vhlnavigation's Introduction

VHLNavigation

微信红包样式导航栏样式切换,颜色过渡切换,导航栏背景图片切换,导航栏透明度切换,有无导航栏切换

Swift 版 VHLNavigation

微信样式 颜色过渡 背景图片 隐藏导航栏 导航栏透明度 导航栏滚动

参考学习

透明与半透明 NavigationBar 切换的三种方案

HansNavController

WRNavigationBar

如何使用

手动拖入 将 VHLNavigation 文件夹拽入项目中

或者通过 pod 导入 pod 'VHLNavigation'

导入头文件:#import "VHLNavigation.h"

隐藏导航栏

[self vhl_setNavBarHidden:YES];

设置背景图片

[self vhl_setNavBarBackgroundImage:[UIImage imageNamed:@"navbg"]];

设置为微信红包样式切换

    [self vhl_setNavBarBarTintColor:[UIColor colorWithRed:0.35 green:0.42 blue:0.58 alpha:1.00]];
    [self vhl_setNavigationSwitchStyle:VHLNavigationSwitchStyleFakeNavBar];

其他属性

设置导航栏背景颜色
[self vhl_setNavBarBackgroundColor:[UIColor whiteColor]];
设置导航栏透明度
[self vhl_setNavBarBackgroundAlpha:1.0f];
设置状态栏样式
[self vhl_setStatusBarStyle:UIStatusBarStyleLightContent];
设置导航栏标题颜色
[self vhl_setNavBarTitleColor:[UIColor whiteColor]];
设置导航栏按钮颜色
[self vhl_setNavBarTintColor:[UIColor whiteColor]];
设置是否隐藏分割线
[self vhl_setNavBarShadowImageHidden:YES];

更新

  • 2019.09.28 修复 iOS 13 下透明度切换颜色问题

  • 2019.09.27 修复 iOS 13 下导航栏默认返回按钮点击闪退问题 适配 iOS 13 模态跳转 PageSheet 切换样式

  • 2019.03.15 修复分享热点,拨打电话等导航栏高度异常问题

  • 2018.12.27 增加单独设置忽略指定的 ViewController

  • 2018.12.04 修复一个模态跳转下,导航栏有可能被遮盖的问题

  • 2018.11.09 增加设置侧滑手势是否启用

  • 2018.11.05 适配 iPhone XR 等状态栏

  • 2018.07.03 优化一个从有状态栏+导航栏切换到无状态栏+无导航栏显示效果

  • 2018.07.02 修复一个TabBarController 下,点击 TabBar,导航栏有概率闪一下的问题

  • 2018.06.14 增加设置导航栏背景View,可以实现比如微信的动态模糊效果与其他效果的切换

  • 2018.06.12 修复一个从有状态栏 pop 到无状态栏时,由于导航栏变窄会将底部内容显示出来的问题

  • 2018.06.07 修复一个模态跳转下,导航栏有概率出现白色背景的问题

  • 2018.04.28 修复了一个继承自UITableViewController导致导航栏显示偏移的问题

  • 2017.09.23 修复了一个隐藏导航栏切换到其他样式导航栏时会出现白色背景的问题。增加导航栏浮动。

  • 2017.09.21 适配 iOS11 和 iPhone X

  • 2017.09.01 增加透明度切换

关于

vhlnavigation's People

Contributors

huanglins avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vhlnavigation's Issues

模态跳转

在我的App 中,模态跳转动画结束后才设置导航栏颜色,在跳转过程中,导航栏则是白色的,Demo 中是没有这个问题,不知道问题出在哪了?

上滚后导航栏出现的效果?

有没有计划实现微信朋友圈里那个向上滚动后导航栏出现的效果?一开始导航栏是透明的,alpha的渐变过程。

默认禁止横竖屏

当前只要pod一添加本库,不写任何代码,本来支持横屏的,瞬间失效。

通过CATransaction completion来结束CADisplayLink并不安全

####问题####
应用启动后,创建root tabbar controller后,VHLNavigation.m: pushNeedDisplay不断空转

####原因####
启动后创建root tabbar controller的自控制器中,有控制器包含了循环动画,导致以下代码执行失败(不会执行)

[CATransaction setCompletionBlock:^{
        [displayLink invalidate];
        displayLink = nil;
        vhlPushDisplayCount = 0;
        [viewController setPushToCurrentVCFinished:YES];
    }];

循环动画导致了CATransaction completion不会执行,从而最终导致空转

####复现####
目标controller

@implementation DisplayViewController

- (void)viewDidLoad {
    [super viewDidLoad];
 
    _testView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    [self.view addSubview:_testView];
    
    
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
    animation.fromValue = @(1);
    animation.toValue  = @(0);
    animation.repeatCount = CGFLOAT_MAX;
    animation.duration = 0.25;
    [_testView.layer addAnimation:animation forKey:@"test"];
}

发起点击controller,“completed”不会打印

@implementation ViewController

- (IBAction)test:(id)sender {
    DisplayViewController *vc = [[DisplayViewController alloc] init];
    
    [CATransaction setCompletionBlock:^{
        NSLog(@"completed");
    }];
    [CATransaction setAnimationDuration:10];
    [CATransaction begin];
    [self.navigationController pushViewController:vc animated:YES];
    [CATransaction commit];
}

setBackgroundColor出bug了

这一句出问题了
if ([viewClassName containsString:@"UIbarBackGround"]) { // iOS 13 下名字变为 UIBarBackground
view.alpha = 0;
}
_UIBarBackground的alpha被改为0,你加到里面的那个backgroudView也就显示不出来了,导致vhl_setBackgroundColor不起作用
机型:iPhone 6s Plus
系统版本:13.1.1
VHL版本: 1.1(pod最新版本)
xcode: 11.0

部分机型设置导航栏透明无效

在iphone 6 12.4.7 系统
还知道在一个iPhone xr 系统未知 上也是,设置的导航栏透明度为0 无效。

其他iPhone X 真机 13.5.1 还有模拟器 都是可以的,请求解决疑惑?

[self vhl_setNavBarBackgroundAlpha:0];

pod库

你好,pod库是不是还没有更新?

webview视频video横竖屏无效

webview视频播放做横屏效果的时候,controller已经横屏了,video还是竖屏,去掉库就正常,Url放原demo,也不行

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.