Coordinate trouble after moving a rotated view

Discussion in 'iOS Programming' started by 99miles, Nov 2, 2008.

  1. 99miles macrumors member

    Oct 10, 2008
    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!
  2. lawicko macrumors member

    Jul 17, 2008
    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.
  3. macrumors newbie

    Nov 5, 2008

    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?
  4. lawicko macrumors member

    Jul 17, 2008
    I know nothing about IB, but I think you should experiment with contentMode property of your view.

Share This Page