MikeN
MikeN

Reputation: 46287

How do you get the absolute x/y position of an embedded element in a UIView?

If you have UIView's embeded within other UIView's, when you get the .frame.origin.x value of a widget in the internal embedded view, it gives you the x/y value for the position in the internal view's coordinate system.

I want to get the x/y position of the element in the absolute coordinate system of the entire iPad visible area. (Or with respect to the top-most view.)

Upvotes: 1

Views: 2251

Answers (1)

Evgeny Shurakov
Evgeny Shurakov

Reputation: 6082

There are methods which can help you to convert frame.
- (CGRect)convertRect:(CGRect)rect toView:(UIView *)view
- (CGRect)convertRect:(CGRect)rect fromView:(UIView *)view

CGRect f = [someView convertRect:someView.bounds toView:window];

Upvotes: 6

Related Questions