views:

28

answers:

3

HI guys.

Part 1. In the IB under Identity tab you can find an attribute called "Object ID". I can not find a way to get hold of this ID from code. Oh, and I know about the tag attribute but it's not what I need.

Part 2. I essentially would like to get the unique object ID for a UIComponent that was touched on the sceen. I already have the UITouch object.

Thanks.

+1  A: 

For UIView I normally use the tag property.

- (IBAction) buttonPressedid) sender {
NSLog(@"tag: %i", [sender tag]);
}

I'm pretty sure you can set the tag property in IB :)

willcodejavaforfood
Thanks for the answer but the problem with tags is that you have to manualy set them up. I am targeting "object ID" b/c it is automatically assign and unique. Unless there is some other object identity that is assign when the object is created and that does not involve manual setup.
Cyprian
A: 

use tags instead of the IB Object ID. As far as I know this object ID is only used in interface builder.

You can set the tag in the Attributes tab.

fluchtpunkt
Thank you, please look at the comment I gave to willcodejavaforfood.
Cyprian
A: 

The Object ID in Interface Builder is only an internal book-keeping value used by IB when deserializing/serializing XIB files, and does no longer exist when the Application runs.

You want to use tag, or alternately, a property/outlet.

Williham Totland