Reputation: 5616
Is it possible to have more than one tag associated with a UIImageView ?
Cheers,
Martin
Upvotes: 1
Views: 215
Reputation: 9698
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.
Upvotes: 1
Reputation: 5133
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.
Upvotes: 2
Reputation: 185852
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.
Upvotes: 1