Visual artifacts on UIView rotation with tiled background image.

Posted by Halbanonym on Stack Overflow See other posts from Stack Overflow or by Halbanonym
Published on 2010-06-13T09:29:18Z Indexed on 2010/06/13 9:32 UTC
Read the original article Hit count: 196

Filed under:
|
|
|
|

I have an iPad app with a standard UIViewController/UIView setup - all rotations are allowed. The UIView draws some tiled image as background (the tile is 256*256 pixels):

- (void)drawRect:(CGRect)rect
{
    [[UIImage imageNamed: @"Background.png"] drawAsPatternInRect: rect];
}

When I turn my iPad I can see that during the rotation the image pattern of the original orientation is scaled to fit the new orientation. Then - immediately after the animation is finished - the view redraws its background pattern with the final configuration which is unscaled. The switching from a scaled to an unscaled pattern looks a bit ugly.

Is there a way to circumvent (or hide) this strecthing of the background pattern?

© Stack Overflow or respective owner

Related posts about uiview

Related posts about background