Search code examples
ioscatiledlayer

Get rid of white tile borders in PhotoScroller


Apple has an iOS sample app called PhotoScroller, which demonstrates CATiledLayer and UIScrollViewer. The sample app shows white boxes around each tile, as a way of illustrating the tiling (i.e. when you zoom in, the tiles represent smaller parts of the image).

How can I get rid of these white lines? I've gone over the code and can't figure out where they've come from. (I'm new to iOS and Objective-C so maybe this is obvious.)


Solution

  • In TilingView.m,

    if (self.annotates) {
        [[UIColor whiteColor] set];
        CGContextSetLineWidth(context, 6.0 / scale);
        CGContextStrokeRect(context, tileRect);
    }
    

    This is the part which strokes the border of the tiles. Remove this part to get rid of the white tile borders.