views:

156

answers:

1

My app is landscape and returns true only for UIInterfaceOrientationLandscapeRight in the root view controller's shouldAutorotateToInterfaceOrientation call.

However when I rotate the device to portrait and back, I sometime see black corners rotate through as if a thick black frame around the display is rotating and just visible on the corner 50 pixels or so.

Any idea what this is or how to fix it?

A: 

The animation on the iphone essentially works by caching the look of the screen each time it's drawn into internally stored bitmaps. When the screen rotates, flips etc. it is actually these cached images which are used in the animation, and the screen itself is not redrawn until the animation is finished.

If you're seeing a black border around your screen, it might be because you're drawing one. However, you may just be describing the normal rotation animation of any app - there is a black background displayed behind the rotated image/cached view as it rotates, because during the rotation there are points where the rotating square shape can't fill the screen to the corners. This black background, as far as I know, is a design decision made by Apple and there isn't a way for developers to change the color.

tjohns20
But my understanding was that if I had shouldAutorotateToInterfaceOrientation returning YES only on UIInterfaceOrientationLandscapeRight, shouldn't the app never rotate? I think what you're saying makes sense and it is doing that rotate, but I can't figure why it's happening. Is there some block of code somewhere that I may have missed? Note that I see the corner rotation artifact but my app itself doesn't rotate. It always stays correctly as landscape right.Thanks
Joey
Update: I discovered that allowing only landscape right resulted in the device making the call to rotate to that orientation everytime I turned it that way. This means when I turned it to portrait, then back, it would recall that rotate anim. Since my visuals don't actually ever rotate away from landscape right, I was seeing just the black border anim each time.I don't know if this is just how it works all the time or if something I am doing wrong with my view setup is causing this side effect, but I was able to deal with it by only allowing the rotation once ever. Thanks.
Joey