Parijat Kalia
Parijat Kalia

Reputation: 5095

setting the tags for my UI elements?

I understand each element that exists on the View/Window has a tag that uniquely identifies it from the other. My question is, I am assuming that these are set by default internally, since clearly the inspector does not provide a way to set a tag for these (or does it?). I would like to be able to set the tag manually as I create my User interface through the NIB files. Is there a way to do this or do I need to go behind the scenes and create the necessary code to be able to do it.

Thanks,

Parijat Kalia

Upvotes: 2

Views: 181

Answers (3)

jsd
jsd

Reputation: 7703

Tags are not set automatically. You have to set them manually either in code (view.tag = someinteger) or using Interface Builder. If you choose the Attributes inspector in Interface Builder, scroll down to the "View" section. There's a box for the Tag value there.

Upvotes: 0

chown
chown

Reputation: 52788

See the Tag box on the right just below the Background color, Alpha, and Mode in the View section. That sets the .tag property of the selected object.

Tag

Upvotes: 1

Gabriel
Gabriel

Reputation: 3045

Setting tags:

UISlider *sliderRed = (UISlider *)[self.view viewWithTag:10];
UISlider *sliderGreen = (UISlider *)[self.view viewWithTag:11];
UISlider *sliderBlue = (UISlider *)[self.view viewWithTag:12];

Is this what you mean? yes it does provide a way.

Upvotes: 0

Related Questions