views:

31

answers:

3

Hi all,

Is it possible to have more than one tag associated with a UIImageView ?

Cheers,

Martin

+1  A: 

The tag serves solely to identify a view within your application. It's kind of like the id attribute in an HTML element; it doesn't make sense to have more than one of them attached to a single view. Use your own data structures to map tags to multiple "things" if you need to.

Marcelo Cantos
+1  A: 

No, tag is just a single property and it's just an integer at that. You could always decide to encode the integer using bitwise OR or something, then AND it with a mask and bit shift to get more than one value out of it. In other words, use bitfields.

Nimrod
+1  A: 

You can use NSMutableDictionary to map your UIImageView with another object. You need to use [NSValue valueWithNonretainedObject:yourView] as the key, and you can create 2 dictionary if you need to map 2 values. Note that the object is not retained, so you should release this dictionary when you are going to release your UIImageView instances.

tia