Problem with UIViewWithTag 0

In the view in IB, I have many elements (including the view itself). ONLY one element has a tag of 0, but the next line works for ANY UITextBox of another, except for a tag with a tag of 0. Note that only ONE UITextBox has a tag of 0, why:

(UITextField *) [self.view viewWithTag: 0]). Text = @ "foo";

Interestingly, when the event received for the element with the tag 0 is triggered, I can easily get the value Tag 0.

Is there a restriction on finding elements of tag 0?

+3
source share
4 answers
+17

, "X" viewwithtag "zero", , , "X" :/idiotic behavior. Apple

+7

. .

:

subviews .

At least it’s properly documented. I think we need a method called subviewWithTag:

+3
source

set self tag as -1. does not affect another presentation tag.

0
source

Source: https://habr.com/ru/post/1719657/


All Articles