CALayer最大尺寸

时间:2012-09-24 15:43:18

标签: cocoa core-animation calayer

是否有最大CALayer尺寸?

我有一个很长的垂直列表,其中包含rootLayer和子图层作为项目,在~16k rootLayer的高度之后,CoreAnimation: surface WIDTH x HEIGHT is too large中出现错误[rootLayer addSublayer:]

有没有办法制作一个非常大的图层? 我尝试使用CATiledLayer代替CALayer但没有成功。

UPD

这是我的代码

static const NSSize itemSize = { 600, 100 };

#import "CAView.h"

@implementation CAView

- (id)initWithFrame:(NSRect)frameRect
{
    self = [super initWithFrame:frameRect];

    CATiledLayer* layer = [CATiledLayer layer];
    layer.tileSize = itemSize;

    self.layer = layer;
    self.wantsLayer = YES;

    return self;
}

- (void)addLayer
{
    static CGFloat itemY = 0.0;

    CATextLayer* layer = [CATextLayer layer];
    layer.string = [NSString stringWithFormat:@"item %ld", [self.layer.sublayers count]];
    layer.backgroundColor = [[NSColor redColor] CGColor];
    layer.frame = NSMakeRect(0, itemY, itemSize.width, itemSize.height);

    [self.layer addSublayer:layer];

    itemY += itemSize.height;

    NSRect frame = self.frame;
    frame.size.height = itemY;

    self.frame = frame;
}

@end

当视图大小变大时,最大OpenGL纹理大小我在视图中闪烁,并且在控制台日志中“CoreAnimation:surface WIDTH x HEIGHT太大”。

0 个答案:

没有答案