0

UIScrollViewテクスチャで塗りつぶしたいサブビューを含むがあります 。

- (void)drawRect:(CGRect)rect {

    CGImageRef image_to_tile_ret_ref = CGImageRetain(wood.CGImage);
    CGRect tile_rect;
    tile_rect.size = wood.size;

    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextBeginPath(context);
    CGContextMoveToPoint(context, 0, 0);
    CGContextDrawTiledImage(context, tile_rect, image_to_tile_ret_ref);
// Something here to make it fill a big area
    CGContextFillPath(context);

    CGImageRelease(image_to_tile_ret_ref);
}

これは、スクロールビューの表示領域を埋めているように見えます。スクロールすると、残りは白になります。長方形の境界を超えて長方形を描くにはどうすればよいですか?それは悪いですか?

4

1 に答える 1

0

これで背景色を描きたいのなら多すぎます。UIScrollViewは背景色を持つことができます。その色は、画像であるパターンから作成することができます。

パターンカラーを作成できます

UIColor * bgColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"imgname.png"]];
scrollView.backgroundColor = bgColor;
于 2010-07-09T15:11:04.057 に答える