I have an NSMutableDictionary
which contains UIImageView
objects and UIView
keys.
When I am setting an UIImageView
to the NSMutableDictionary
I get the NSValue
out from the UIView
like this:
[viewImageMap setObject:anImage forKey:[NSValue valueWithNonretainedObject:aView]];
I want to know if there is anyway I can obtain the UIView
reference back with the NSValue
object. Something like this:
UIView *aView = (UIView *)[NSObject objectWithValue:aValue];
For each valueWith<Type>:
method, NSValue
has a complementary method that returns the stored value in the appropriate type.
The one you need is nonRetainedObjectValue
.
UIView * theView = [theValue nonRetainedObjectValue];