如何根据其地址在“调试视图层次结构"中查找视图? [英] How to find views in Debug View Hierarchy based on their address?
问题描述
有时候我们都会得到它们.
We all get them sometimes..
** [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x608000287670 H:|-(16)-[UIView:0x7fe38456eeb0](LTR) (active, names: '|':MyApp.MyCell:0x7fe3848d9400'MyCellIdentifier' )>",
"<NSLayoutConstraint:0x6080002876c0 UIView:0x7fe38456eeb0.right == MyApp.MyCell:0x7fe3848d9400'MyCellIdentifier'.right (active)>",
"<NSLayoutConstraint:0x608000288520 'UIView-Encapsulated-Layout-Width' MyApp.MyCell:0x7fe3848d9400'MyCellIdentifier'.width == 0 (active)>"
)
您不必读懂它的含义,它实际上与这个问题没有任何关系.在对我的应用程序进行了一些重大更改之后,日志开始显示在我的日志中.我已经用谷歌搜索过,并且我知道这个特殊的问题很奇怪,我必须找到一个特定的约束,并将其优先级设置为 999 ,以便系统可以将单元格的宽度设置为0如果愿意的话.这可以.
You don't have to read into what it means, it doesn't really have anything to do with this question. This started showing up in my log after I did some major changes to my app. I have googled it, and I understand that this particular issue is a weird one where I have to find a certain constraint, and set its priority to 999, so that the system can set the cell's width to 0 if it wants to. This is fine.
我的问题并不直接针对这个特定问题.每当我在日志中得到这样的信息时,在类名之后总是会有一个地址.就像上面示例中显示的那样: MyApp.MyCell:0x7fe3848d9400
.
My question is not directly directed towards this particular issue. Whenever I get something like this in the log, there's always an address following the class name. Like the one shown in the example above: MyApp.MyCell:0x7fe3848d9400
.
我可以使用该地址并搜索视图层次结构来查找视图吗?我知道,如果单击 Debug View Hierarchy (调试视图层次结构),则会得到我的应用程序的甜美"stasis"视图.问题是我的应用程序越来越大,而且我有很多意见.特别是在 UITableView
中.当前有很多视图,每个视图都有自己的地址.
Can I use this address and search the view hierarchy to find the view?
I know that if I click Debug View Hierarchy I get a sweet "stasis" view of my app. The problem is that my app is getting pretty big, and I have a lot of views. Especially in UITableView
's. There are so many views present, each with their own address.
如果在调试层次结构中选择任何视图,则可以很容易地看到其地址,如下图右上角所示.
If I select any view in the debug hierarchy, I can easily see its address, as seen in the top right corner in the image below.
由于我已经有了要查找的视图的地址,是否可以找到它?我现在要做的是在调试屏幕上浏览 all 相关视图,复制其地址,然后 CMD + F
CMD +V
到我的输出日志中,以查看我的日志输出中是否提到了该特定视图.
Since I already have the address of the view I want to find, is there a way to locate it? The way I'm doing it now, is to go through all the relevant views on my debug-screen, copy their address, and CMD+F
CMD+V
into my output log to see if that particular view was mentioned in my log output.
必须有更好的方法.
推荐答案
如果在导航器窗格"底部的搜索字段中键入(或复制/粘贴)十六进制地址,则它应该过滤/查找对象:
If you type (or copy/paste) the hex address into the search field at the bottom of the Navigator Pane, it should filter / find the object:
这篇关于如何根据其地址在“调试视图层次结构"中查找视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!