Reputation: 536
I am trying to access property of UIView stored in NSArray but getting "Property 'center' not found on object of type'id'" message. What can i do to avoid this?
[_toggles objectAtIndex:i-1].center = CGPointMake(i * (toogleSize + freeSpace) - 24, 48);
Upvotes: 0
Views: 32
Reputation: 7390
You can cast the result of _toggles[i-1]
to a UIView*
and then access the center
property:
((UIView*)_toggles[i-1]).center = CGPointMake(...);
You just have to remember the parentheses in the right place to make sure you cast _toggles[i-1]
before you access center
.
Upvotes: 1