Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改非 topViewController 的 leftBarButtonItem 会影响 topViewController 自定义返回按钮的布局 #335

Closed
4 tasks done
MoLice opened this issue May 22, 2018 · 2 comments
Labels

Comments

@MoLice
Copy link
Collaborator

MoLice commented May 22, 2018

请填写运行环境

  • 设备:模拟器
  • 系统:iOS 11.3
  • Xcode 版本:9.3
  • QMUI iOS 版本:2.6.2

请描述具体问题

从界面 A push 进界面 B,而界面 B 使用了自定义返回按钮。
此时如果再去改界面 A 的 leftBarButtonItem,会看到界面 B 的返回按钮往右边跳动。

@MoLice
Copy link
Collaborator Author

MoLice commented May 22, 2018

相关代码在 UIBarButtonItem (QMUINavigationButton_Private) 里。

问题分析

后来再改界面 A 的 leftBarButtonItem 时,会导致重新对 navigationBar.qmui_customizingBackBarButtonItem 进行赋值,而如果这个属性前后的值不同,就会导致 navigationBarcontentViewlayoutMargins 变化,表现出来就是返回按钮跳动。

解决方式

setLeftBarButtonItem 时应该对当前的 navigationItem 是否是 topItem 进行判断,如果修改的是非可视的 item,则不操作 navigationBar 布局相关的东西。

@MoLice MoLice added the bug label May 24, 2018
@MoLice
Copy link
Collaborator Author

MoLice commented Jun 5, 2018

2.7.0 版本已发布,修复了这个问题。

@MoLice MoLice closed this as completed Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant