convertPoint:toView: in landscape mode giving wrong values

Viewed 5940

I have a view which is created in landscape mode (long after rotation etc.).
In this view, I want to find a point relative to the main window.
The following code works in portrait mode, but in landscappe it still returns values as if it were in portrait.

CGPoint ptRelativeToWindow = [self convertPoint:self.bounds.origin toView:nil];

Solved

This solved the problem and gives the right coordinates:

[self convertPoint:self.bounds.origin toView:[UIApplication sharedApplication].keyWindow.rootViewController.view];
1 Answers
Related