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

UISlider+QMUI使用,qmui_step赋值和qmui_stepDidChangeBlock的实现先后顺序,会影响qmui_stepDidChangeBlock的调用 #1413

Closed
MainByElse opened this issue Jun 23, 2022 · 2 comments
Labels

Comments

@MainByElse
Copy link

Bug 表现
UISlider+QMUI
qmui_numberOfSteps大于2,默认选中step非0的选项,此时第一次选中step为0选项时,qmui_stepDidChangeBlock回调未被调用

原因:
使用时,先赋值qmui_step,再实现qmui_stepDidChangeBlock改变回调时,此时选择step为0的选项,qmuisl_handleValueChanged方法中qmuisl_precedingStep和step此时都为0,所以未执行监听block,导致qmui_stepDidChangeBlock回调未调用

截图
1、赋值代码
image
2、UISlider+QMUI中点击step为0选项时
image

如何重现

  1. 先赋值qmui_step > 0的值
  2. 再实现qmui_stepDidChangeBlock回调
  3. 此时选中step为0的选项,qmui_stepDidChangeBlock未被调用

预期的表现
qmui_step的赋值和qmui_stepDidChangeBlock的实现先后顺序,应该不影响qmuisl_handleValueChanged方法中的判断

目前先实现qmui_stepDidChangeBlock,再赋值qmui_step即可避免这个问题

其他信息

  • 设备: 模拟器iPhone 13 Pro
  • iOS 版本: iOS 15.5
  • Xcode 版本: Xcode 13.4.1
  • QMUI 版本: 4.4.3
@MoLice MoLice added the bug label Jun 23, 2022
@MoLice
Copy link
Collaborator

MoLice commented Jun 23, 2022

下个版本会修复该问题,在此之前可以先用以下文件替换你本地的同名文件:
UISlider+QMUI.m.zip

@MoLice
Copy link
Collaborator

MoLice commented Aug 10, 2022

已发布 4.5.0 修复该问题。

@MoLice MoLice closed this as completed Aug 10, 2022
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

2 participants