Cyprian
Cyprian

Reputation: 9453

How to access Object ID Identity attribute?

  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.

  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.

Upvotes: 13

Views: 8911

Answers (3)

Williham Totland
Williham Totland

Reputation: 29009

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.

Upvotes: 4

Matthias Bauch
Matthias Bauch

Reputation: 90117

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.

Upvotes: 1

willcodejavaforfood
willcodejavaforfood

Reputation: 44063

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 :)

Upvotes: 1

Related Questions