here is the problem i am facing: i am creating a UIScrollView which will have a template image to fill the background . That is, I need a background to scroll using UIScrollView. A good example of this is the Game Center app on the iPad. The background will scroll smoothly by scrolling.
I currently have two ways to implement this effect, but none of them have shown good performance . I tried this first
self.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:kRLCastViewBGUnit]];
but unfortunately the scroll performance was very poor and took up too much memory.
Then I tried using CGContextDrawTiledImage in drawRect as follows:
- (void)drawRect:(CGRect)rect
{
CGContextRef currentContext = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(currentContext, 0, rect.size.height);
CGContextScaleCTM(currentContext, 1.0, -1.0);
CGContextClipToRect(currentContext, rect);
CGRect centerTileRect = CenterTileRect;
CGContextDrawTiledImage(currentContext, centerTileRect, [ResourceProvider backgroundTileImageRef]);
}
iPad. , , - , Game Center , . - UIScrollView? !