Skip to content

QMUIButton使用约束布局在vc.navigationItem.titleView上时可能会导致闪退 #1680

@CloudlessMoon

Description

@CloudlessMoon

Bug 表现
QMUIButton使用约束布局在vc.navigationItem.titleView上时可能会导致闪退

截图

Image

The layout constraints still need update after sending -updateConstraints to <_UINavigationBarTitleControl: 0x15b298300; frame = (0 0; 0 0); layer = <CALayer: 0x15ae2ca20>>. _UINavigationBarTitleControl or one of its superclasses may have overridden -updateConstraints without calling super. Or, something may have dirtied layout constraints in the middle of updating them. Both are programming errors.

如何重现
① 设置QMUIButton.translatesAutoresizingMaskIntoConstraints = fasle,完整代码如下图所示:

Image

② 设置vc.navigationItem.titleView 为如上图所示的 QDTestTitleView

Image

③ present这个vc

Image

注意:以上步骤缺一不可

这个评论#1679 (comment) 有可能是同一个问题导致

预期的表现
正常情况下,应该不会崩溃

其他信息

  • 设备: iPhone 11或者iPhone 11模拟器
  • iOS 版本: iOS 26.0
  • Xcode 版本: Xcode 26.0
  • QMUI 版本: 4.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions