PDA

View Full Version : Using CATiledLayer




North Bronson
Dec 12, 2009, 10:26 PM
Does anyone have experience using CATiledLayer for a large view?

I have an Image View that I'm adding to a UIScrollView. I thought about subclassing UIImageView to look like this:

@interface CustomImageView: UIImageView

@end

@implementation CustomImageView

+ (Class)layerClass
{
return [CATiledLayer class];
}

@end

Is that really all that I need to have the benefits of the tiled layer? Am I missing something here?

I'm not sure what I should be looking for to see if it's really working well or not.



PhoneyDeveloper
Dec 13, 2009, 01:56 PM
UIImageView isn't meant to be subclassed.

The point of CATiledLayer is that you can provide the contents of the view in tiles. If you do that then you can use less memory because only part of the view's contents need to exist at any time. There would be no point to creating a single view for display in a tiled layer. You need to be able to create tiles.

The code that you show may work but there's no benefit.