GithubHelp home page GithubHelp logo

Comments (6)

SmileZXLee avatar SmileZXLee commented on May 28, 2024

zx_navItemMargin

您好,我将demo运行至iOS 10.3的模拟器上未发现异常,如果方便的话,麻烦您提供一下您对ZXNavigationBar的具体设置或提供一个demo来帮助我复现和解决此问题,感谢!!

from zxnavigationbar.

duduwei avatar duduwei commented on May 28, 2024

这个问题发生在:在基类控制器中设置了zx_navLeftBtn的大小,在次控制器中就会出这个问题。已复现。

这是基类代码:

-(void)viewDidLoad{
[super viewDidLoad];

self.view.backgroundColor = UIColor.whiteColor;

self.zx_navStatusBarStyle = ZXNavStatusBarStyleDefault;
self.zx_navTitleColor = UIColor.blackColor;
self.zx_navTitleFont = [UIFont systemFontOfSize:17 weight:UIFontWeightRegular];
self.zx_navLineView.hidden = YES;


if(self.navigationController.viewControllers.count>1){
    UIImage* lefImg = [UIImage imageNamed:@"arrow_left"];
    [self zx_setLeftBtnWithImg:lefImg clickedBlock:^(ZXNavItemBtn * _Nonnull btn) {
        [self.navigationController popViewControllerAnimated:YES];
    }];
    self.zx_navLeftBtn.zx_fixWidth = 44;
    self.zx_navLeftBtn.zx_fixHeight = 44;
    self.zx_navLeftBtn.zx_fixImageSize = CGSizeMake(lefImg.size.width, lefImg.size.height);
    //self.zx_navLeftBtn.backgroundColor = UIColor.orangeColor;
}

}

这是次控制器的代码
[self zx_setLeftBtnWithImg:[UIImage imageNamed:@"arrow_leftWhite"] clickedBlock:^(ZXNavItemBtn * _Nonnull btn) {
[self gotoBack];
}];
[self zx_setRightBtnWithText:@"活动规则" clickedBlock:^(ZXNavItemBtn * _Nonnull btn) {
[self activityRules];
}];
//self.zx_navItemMargin = 10;

from zxnavigationbar.

SmileZXLee avatar SmileZXLee commented on May 28, 2024
  • 如果要更改返回按钮图片,只需要在基类控制器中设置:self.zx_backBtnImageName=@"图片名称"即可。
  • 不需要配备不同颜色的返回图片,设置导航栏或self.zx_leftBtnzx_tintColor属性即可。
  • 不建议您根据图片大小设置self.zxleftBtn的大小,这会导致当您在不同控制器的返回图片大小不一样的情况下,self.zxleftBtn的大小也不一样。如果需要设置导航栏按钮的大小,可以通过
//设置指定导航栏按钮大小
self.zx_navLeftBtn.zx_fixWidth = 44;
self.zx_navLeftBtn.zx_fixHeight = 44;

//设置所有导航栏按钮大小
self.zx_navItemSize = 44;

进行设置。

  • 在self的block中使用self会导致循环引用,请使用weakSelf。

from zxnavigationbar.

duduwei avatar duduwei commented on May 28, 2024

在iOS10.3的系统上(我用的真机),按照你的上面的建议这个问题依然存在。
只要在一个控制器中同时设置了self.zx_navLeftBtn.zx_fixWidth和右按钮,右按钮就存在这个问题。我在viewdidapper中打印了zx_navRightBtn的frame,发现它的宽度更新了,但x值没被更新。
我有时间也会帮忙查一下这个问题的根本原因。另外一个要注意的点是,如果我设值了zx_fixWidth,我必须更改imageView.contentMode从UIViewContentModeScaleToFill到UIViewContentModeCenter,才能使图片不变形,这个跟图片大小有关,不是代码问题,只是一个使用者需要注意的点。

from zxnavigationbar.

SmileZXLee avatar SmileZXLee commented on May 28, 2024

您好,我使用本项目的demo未能复现。ZXNavigationBar最新版本为1.3.1,如果您不是最新版本,请更新到最新版本试一下哈。若问题依然存在,可以录个视频或提供一个demo帮助我复现和解决此问题。您也可以下载此项目的demo运行才10.3上测试一下。

from zxnavigationbar.

duduwei avatar duduwei commented on May 28, 2024

很抱歉,准确的说是10.3.3系统。1.3.1也存在。以下是一些表现 https://www.jianshu.com/p/746536b72fdf

from zxnavigationbar.

Related Issues (20)

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.