In one of my blog How to monitor the control registration and deregistration ,
I demonstrate one approach to enable you to find the location where a given control which you are interested is created or destructed.
Still use the master list below for example:
In the xml view, its id is defined as “list”:
And in the runtime, the id has naming convention “__xmlview[id]–list”. Where is this runtime id generated?
Following the tips in my previous blog, we can easily find the callstack where control runtime id is generated.
By reading the code if seems the runtime id did consist of container xml view id and the control id itself defined in xml view.
In order to prove my assumption, I wrote the following code and re-launch my UI. This time the breakpoint is triggered, with the very list id “list” passed in.
After I debugged into function createId in line 334, I get my guess verified: the runtime id of a control consists of its container view’s id and its own id defined in the container view, as displayed below:
要获取更多Jerry的原创文章,请关注公众号"汪子熙":