使用 titleView 弹出到 navigationItem 时崩溃

发布于 2025-01-13 23:41:30 字数 567 浏览 1 评论 0原文

我在日志中看到了此崩溃,但无法重现。当我弹出到导航堆栈中的上一个 UIViewController 并且该视图控制器具有自定义 titleView 设置时,就会发生这种情况。我自己无法重现崩溃,它似乎正在处理 UINavigationBar 内部的视图。有什么想法吗?

Fatal Exception: NSGenericException
Unable to activate constraint with anchors <NSLayoutXAxisAnchor:0x2823d3d80 "_UITAMICAdaptorView:0x106d354f0.leading"> and <NSLayoutXAxisAnchor:0x282312640 "UILayoutGuide:0x280134000'TitleView(0x104b96cc0)'.leading"> because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal.

I've been seeing this crash in logs, but unable to reproduce. It occurs when I pop to previous UIViewController in navigation stack, and that view controller had a custom titleView set. I haven't been able to reproduce the crash myself, and it seems to be dealing with views internal to UINavigationBar. Any ideas?

Fatal Exception: NSGenericException
Unable to activate constraint with anchors <NSLayoutXAxisAnchor:0x2823d3d80 "_UITAMICAdaptorView:0x106d354f0.leading"> and <NSLayoutXAxisAnchor:0x282312640 "UILayoutGuide:0x280134000'TitleView(0x104b96cc0)'.leading"> because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

也只是曾经 2025-01-20 23:41:30

我遇到了类似的问题,并通过减小 TitleView 标签的字体大小来解决它。

I had a similar problem and solved it by reducing the font size of the TitleView label.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文