tags:

views:

711

answers:

1

Hi, On view in IB I have numerous items (including view itself). ONLY one item has tag 0, yet following line works for ANY UITextBox other then the one with tag 0. Note that only ONE UITextBox has tag 0, why:

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

Interesting that when triggered event received for the element with tag 0, I can get value of Tag 0 with no problem.

Is there a limitation to look for tag 0 elements?

+1  A: 

All views have a 0 tag as a default so if you get a 0 view it could be any view. For it to work you need to use non-zero values that you set in your program or within Interface builder.

Boiler Bill
Does viewWithTag:0 return "the FIRST view with a tag of 0"?(My app always just crashes instead.... because I have MANY 0 tags.)
Bonnie