Using CATiledLayer

Discussion in 'iOS Programming' started by North Bronson, Dec 12, 2009.

  1. North Bronson macrumors 6502

    Oct 31, 2007
    San José
    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
    @implementation CustomImageView
    + (Class)layerClass
        return [CATiledLayer class];
    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.
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    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.

Share This Page