Reputation: 393
How can I tell the relative position (x & y) of uiimageview B relative (or the "inside of" position ??) of UIImageView B?
Upvotes: 1
Views: 207
Reputation: 11174
frame is the property you are looking for, it gives you the origin and size of a view, relative to its superview
UIView *a = //outer view
UIView *b = //inner view
[a addSubview:b];
CGRect bFrame = b.frame;
NSLog(@"%@", NSStrinFromCGRect(bFrame)); //will be something like (100, 100, 40, 20)
edit: I didnt realise they werent subviews (I dont use IB), so you will need to convert to the coord system of a:
CGRect bFrame = [a convertRect:b.frame fromView:b.superView];
Upvotes: 1