PDA

View Full Version : Coordinate trouble after moving a rotated view




99miles
Nov 2, 2008, 03:39 PM
Hi-
I have a view that I rotate 90 degrees when the phone flips to the left landscape orientation. This is done automatically by shouldAutorotateToInterfaceOrientation.

At that point when I click on the rotated view, hitTest is accurate, as the coordinates for that view have automatically been updated by something under the hood.

However, if i then move that view, the coordinates are off. It seems that it forgot that it's rotated. If I touch on the view, hitTest doesn't think I'm on the view, but if I touch above the view it think it's been hit.

I tried setting the rotation again after the move to see if it would update the coordinates, but that didn't help.

Any ideas?
Thanks in advance!



lawicko
Nov 3, 2008, 02:16 AM
I guess you use CGAffineTransform to translate the view, right? If yes, try to animate center property of the view instead. It worked for me when I had similar issue some time ago.

developer.in
Nov 5, 2008, 02:52 AM
I guess you use CGAffineTransform to translate the view, right? If yes, try to animate center property of the view instead. It worked for me when I had similar issue some time ago.

Hi

I'm trying to rotate a view which has a nav bar, a toolbar and the center of the view has an imageView. When I rotate the phone to left landscape, the toolbar disappears and the image which was displaying in the center of the screen snaps to right below the navbar. What view settings for the UIImageView should I specify in the IB?

lawicko
Nov 5, 2008, 03:25 AM
I know nothing about IB, but I think you should experiment with contentMode property of your view.