Using CATiledLayer

Discussion in 'iPhone/iPad Programming' started by North Bronson, Dec 12, 2009.

  1. macrumors 6502

    Joined:
    Oct 31, 2007
    Location:
    San José
    #1
    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:

    Code:
    @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.
     
  2. macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    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