使用 titleView 弹出到 navigationItem 时崩溃
我在日志中看到了此崩溃,但无法重现。当我弹出到导航堆栈中的上一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了类似的问题,并通过减小 TitleView 标签的字体大小来解决它。
I had a similar problem and solved it by reducing the font size of the TitleView label.