Iphone – How to get uicontrols by their ID in iphone dev environment

iphoneuibutton

I'm just starting to learn the iphone API, and I've done plenty of windows programming, and I'm sure there's a way, given the object passed to an event handler, to identify its object id or tag or something.

I created a series of UIButtons in the interface builder, and each has an object ID.
But I just can't see where in the iphone API you can get that ID from the UIButton object.

I see everybody going by titleforstate, but that doesn't work for me because they all have the same title. Or do I put an image in the button and use the title as the ID?

The interface builder has an "interface builder identity" which I'm guessing I don't have access to from the iphone API, do I?

There's also a setting called "Tag" in the "view" section of the button attributes, but it's a number. That will do, but I don't see any API call to get that either.

I'm just trying to figure out how to identify a UI control by some means other than it's title.
Thanks.

Best Solution

it's inherited from NSObject, you just need to call for variable.tag