Giter VIP home page Giter VIP logo

gknavigationbar's Introduction

Hi there 👋

This is QuintGao,a rookie iOS developer。Now that you're here, why don't you pay attention!

✍ Blog & Writing

简书:QuintGao
掘金:QuintGao

📈 GitHub Stats

QuintGao's GitHub Stats

ꗀ Repositories

gknavigationbar's People

Contributors

codereylee avatar quintgao 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  avatar  avatar  avatar  avatar

gknavigationbar's Issues

导航栏左右按钮设置的间距,有时候会失效

在第一级界面设置好导航栏按钮间距,进入到子界面时候,再次返回会导致导航栏间距失效。

目前确定会发生的条件:在第一级界面设置按钮间距,进入图片预览(使用的是TZImagePreviewController预览功能),关闭预览功能之后,导航栏按钮间距失效。

死循环调用

gk_layoutSubviews 里面再调用
[self gk_layoutSubviews];
不会死循环吗?

设置self.gk_navItemLeftSpace作用于所有navigationBar吗?

appdelegage中配置[GKConfigure setupCustomConfigure:gk_navItemLeftSpace为10,之后再控制器中单独设置gk_navItemLeftSpace为20,push下一页面后,gk_navItemLeftSpace还是20,所以,想问一下,gk_navItemLeftSpace属性是作用于所有navigationBar吗?

configure.titleColor有种情况会无效

有设置configure.titleColor = [UIColor redColor];
在VC中

  • (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor whiteColor];
    self.gk_navigationItem.title = @"MainVC";
    // self.gk_navBackgroundColor = [UIColor redColor];
    // self.gk_statusBarStyle = UIStatusBarStyleLightContent;
    // self.gk_navTitleFont = [UIFont systemFontOfSize:18.0f];
    // self.gk_navTitleColor = [UIColor whiteColor];
    }

此时标题颜色不是redColor,还是黑色的

设置无效果

按照这样的步骤。通过cocoapods 集成

1、在AppDelegate中添加导航配置
[GKConfigure setupDefaultConfigure]
2、创建根导航控制器
然后是tabbar 里设置的
NSArray *vcs = @[vc1,vc2,vc3,vc4];
NSMutableArray *viewControllers = [NSMutableArray arrayWithCapacity:0];
[vcs enumerateObjectsUsingBlock:^(UIViewController *obj, NSUInteger idx, BOOL * _Nonnull stop) {
UINavigationController *nav = [UINavigationController rootVC:obj];
[viewControllers addObject:nav];
}];
self.viewControllers = viewControllers;
3、设置导航栏属性(调用即创建)
self.gk_statusBarHidden = YES;
self.gk_navLineHidden = NO;这些设置都无效

13.4状态栏

  • (BOOL)prefersStatusBarHidden {
    return self.gk_statusBarHidden;
    }

  • (UIStatusBarStyle)preferredStatusBarStyle {
    return self.gk_statusBarStyle;
    }
    Jietu20200328-131524
    基类添加这两个方法后,启动后,切换其他tabbar会出现

swift

能出个swift版本的吗

ios13下,设置gk_navItemLeftSpace属性无效

  • 调试发现

  • (void)setGk_navLeftBarButtonItem:(UIBarButtonItem *)gk_navLeftBarButtonItem {
    objc_setAssociatedObject(self, &kAssociatedObjectKey_navLeftBarButtonItem, gk_navLeftBarButtonItem, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

    self.gk_navigationItem.leftBarButtonItem = gk_navLeftBarButtonItem;
    }
    ios13下,程序走到这里就结束了,不进里面调整间距的代码

设置配置问题

// 配置导航栏属性
[GKConfigure setupCustomConfigure:^(GKNavigationBarConfigure * _Nonnull configure) {
    configure.gk_translationX = 15;
    configure.gk_translationY = 20;
    configure.gk_scaleX = 0.90;
    configure.gk_scaleY = 0.92;
    // 导航栏背景色
    configure.backgroundColor = [UIColor whiteColor];
    // 导航栏标题颜色
    configure.titleColor = tabbarBlackColor;
    // 导航栏标题字体
    configure.titleFont = MedFont17;
    // 导航栏返回按钮样式
    configure.backStyle = GKNavigationBarBackStyleBlack;
    // 导航栏左右item间距
    configure.gk_navItemLeftSpace = WidthOfScale(8.5);
    configure.gk_navItemRightSpace = 12.0f;
}];

这个设置完并没有生效
图片
你的源码内部直接调用默认配置,这个有问题吧

tabbar问题

带tabBar的Controller,你是用的截图push ,但是我的控制器是播放器,截图就会出现图像静止,声音仍然在放的问题。有没有不用截图的解决办法啊

借用作者平台说下我的理解

在多人开发的项目中,你不能要求所有人都一定要懂GK,GK的构架和系统的不是一回事;
我一直以为对系统的东西应该抱有敬畏的心态
毕竟人家底层做了优化,自己写的肯定多多少少有差距,而且也是通过调其他的Api,相当于脱了裤子放屁
用GK主要是对系统的把握不清
今天和朋友聊过,好像iOS版本不一样对应的一些生命周期都有变动,这里不过多赘述是哪些Api
我的理解是,系统的不要屏蔽,让新来的朋友可以自由发挥自由选择到底是用GK还是系统的

我这里写了一个轮子,我自己自测了没问题,我也没有单元测试,请广大网友多多留言
这个轮子我没有pod,你们下载来自己研究便好。
主要对系统的Tabbarctr 那一系列 以及nav 那一系列做了一些调整
一方面是拓展功能,一方面是做标记,mark以下,本来我的记忆也不太好
程序员不都是靠轮子吃饭吗?
最好统一 要不然代码乱糟糟的,互相影响,有时候排查问题乱糟糟
我们不需要中间过程,甚至少关心中间过程,集中注意力往该用力的方向使劲

我的demo:
https://github.com/295060456/TabbarItemLottie

也是广泛阅读了网上的各种帖子,我也是站在大神的高度提出我的一些建议和想法
demo我会持续更新。有问题留言。

反正说一下就是:

(void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = RandomColor;

self.isHiddenNavigationBar = NO;
}

(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
}

self.isHiddenNavigationBar = NO;这个属性决定是否关闭系统的导航栏,关了你用GK,不关你用不来GK你继续系统
学习GK用分类无入侵,你不调方法永远不会开辟内存。

以我的demo为例子,必须使用BaseNavigationVC,直接用系统的没效果

下载demo,运行工程,点击第一个Tabbaritem对应的VC,推到另一个VC里面,具体实现在VC_9里面
self.isHiddenNavigationBar = NO;//这一句决定是否有navigationbar

返回按钮

你的按钮大小固定了,这样我替换了图片也没用,这样间距设置不了,可以提供一个返回按钮自定义的吗

状态栏设置无效

self.gk_statusBarStyle = UIStatusBarStyleLightContent;
viewDidLoad当中设置无效

还有个问题

@implementation GKBaseAnimatedTransition

这么写

  • (instancetype)transitionWithScale:(BOOL)isScale {
    return [[GKBaseAnimatedTransition alloc] initWithScale:isScale];
    }

否则 我手动拖你的项目到我的项目里面编译不通过,因为Multiple methods named 'initWithScale:' found with mismatched result, parameter type or attributes
全局搜索 发现是和 YYKit 里面的 YYImageCoder 的initWithScale 冲突
改正以后编译通过。

经过测试KSYMediaPlayback 的 prepareToPlay会影响禁止侧滑(我自己打断点看源码已经解决,望作者采纳)

  • (void)viewDidLoad {
    [super viewDidLoad];
    self.gk_interactivePopDisabled = YES;
    self.gk_fullScreenPopDisabled = YES;
    WeakSelf
    [self requestAdBlock:^(id data) {
    if ((Boolean)data) {

          [weakSelf addPlayVideo];
          [weakSelf dataGet];
    
      }else{
    
          [weakSelf.navigationController popViewControllerAnimated:YES];
    
      }
    

    }];
    //
    [self addNotifi];
    }

在SceneDelegate.m
-(UINavigationController *)navigationController{
if (!_navigationController) {
// _navigationController = [[UINavigationController alloc] initWithRootViewController:self.customSYSUITabBarController];
_navigationController = [UINavigationController rootVC:self.customSYSUITabBarController
transitionScale:NO];
_navigationController.navigationBar.hidden = YES;
}return _navigationController;
}

[self.mkPlayVideo.mkPlayer prepareToPlay];在addPlayVideo里面,目前解决方案还在研讨中ing

https://www.jianshu.com/p/4a569fd64c93用这种方法可以实现效果 但是为什么不走GK的我还在想...

解决方案:

1、在 - (void)propertyChangeNotification:(NSNotification *)notification 里面的 if (vc.gk_interactivePopDisabled)分支:
更改为:
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
//这里对添加到右滑视图上的所有手势禁用
for (UIGestureRecognizer *popGesture in self.interactivePopGestureRecognizer.view.gestureRecognizers) {
popGesture.enabled = NO;
}
}
self.interactivePopGestureRecognizer.delegate = nil;
self.interactivePopGestureRecognizer.enabled = NO;
[self.interactivePopGestureRecognizer.view removeGestureRecognizer:self.screenPanGesture];
[self.interactivePopGestureRecognizer.view removeGestureRecognizer:self.panGesture];

2、在 - (instancetype)initWithRootVC:(UIViewController *)rootVC transitionScale:(BOOL)transitionScale 里面添加:
self.interactivePopGestureRecognizer.delegate = self.gestureHandler;

遗憾:
禁止全屏滑动,支持边缘滑动 这里面怎么写 没时间研究了
其他地方涵盖以及兼容问题没看

影响原有的导航

引入之后,不做任何操作,影响其他的导航显示,自动向左右偏移
图片

使用TZImagePickerController闪退

252A6A7354C9C223A9F6D7EF66E53E49

[TZImagePickerController-master.zip](https://github.com/QuintGao/GKNavigationBar/files/4971075/TZImagePickerController-master.zip) 不知道是不是冲突了

gk_backImage设置问题

appdelegate设置
[GKConfigure setupCustomConfigure:{
configure.backImage = ImgName(@"btn_back_black");//设置返回按钮图片
}
push的下个页面,如果无返回按钮的话,怎么设置呢?

侧滑不行

https://github.com/295060456/JobsSearch

因为这个东西我最近还在写,你拉代码的时机我没法掌控,简单做以下说明:
1、如果启用FDFullscreenPopGesture 文件夹下的两个类 UINavigationController+FDFullscreenPopGesture 和 UIScrollView+FDFullscreenPopGesture(在target membership里面打钩包含资源文件进编译树,就是Xcode右侧的侧边栏那边)
没毛病

但是我想你既然写了这个,我就用你的,那么1不打勾不包含的情况下,在@implementation JobsSearchVC 里面的viewDidLoad实现了以下代码:
self.isBackBtnBlackorWhite = YES;
self.gk_navLeftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.backBtnCategory];
self.gk_navRightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.scanBtn];
self.gk_navBackgroundColor = self.bgColour;
// self.gk_captureImage;
self.gk_interactivePopDisabled = NO;
self.gk_fullScreenPopDisabled = NO;

    self.gk_navTitle = self.titleStr;
    [self hideNavLine];
    [self.view bringSubviewToFront:self.gk_navigationBar];
    self.gk_navigationBarHeight = self.gk_navigationBar.mj_h;

执行失败!!!!

我害怕其他变量进行了影响,为了环境的纯洁,我在其他控制器(ViewController_2 ——> ViewController_3)里面作如下操作同样失败;
ViewController_3 代码如下:
self.gk_navTitle = @"Demo";
self.gk_navTitleColor = [UIColor whiteColor];
self.gk_navBackgroundColor = [UIColor redColor];
self.gk_navShadowColor = [UIColor blackColor];
self.gk_backStyle = GKNavigationBarBackStyleWhite;
self.gk_navItemRightSpace = 0;

self.gk_interactivePopDisabled = NO;
self.gk_fullScreenPopDisabled = NO;

cocopods problems

[!] CocoaPods could not find compatible versions for pod "GKNavigationBar":
In Podfile:
GKNavigationBar (~> 1.1.3)

None of your spec sources contain a spec satisfying the dependency: GKNavigationBar (~> 1.1.3).

You have either:

  • out-of-date source repos which you can update with pod repo update or with pod install --repo-update.
  • mistyped the name or version.
  • not added the source repo that hosts the Podspec to your Podfile.

【重大Bug】不走dealloc

我就说我的代码对于每一个push的VC不走dealloc
我仔仔细细检查每一句代码
现在锁定为这一句:
self.gk_navLeftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.backBtnCategory];
加上不走dealloc
去掉这句话,直接手势回退上一个页面就走dealloc
不走dealloc,对象没销毁,下次赋值都会异常,我以前就出现过这个问题,内存也会暴增,也会影响到里面的NSTimer销毁周期
具体为什么会这样,我还在看代码,有问题随时上报;

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.