views:

46

answers:

1

I'm trying to draw a semi-transparent shape over an image.

I've got a UIView which has it's layer's contents set to the image, with a CAShapeLayer sub-layer who's path is set to the shape. There are a few of these UIViews inside a parent UIView, which is the zoom child of a UIScrollView.

Everything is fine on the iPhone, but when I zoom in on the iPad, the UIViews get quite large, and the CAShapeLayers disappear. The images display fine though. I guessed that the problem was a size issue, so I split the CAShapeLayers in two, so that there was a left and a right side. Now, they both get shown unless the user zooms in really far, for example while "un-pinching" beyond my maximum zoom, just before they bounce back.

Splitting up my CAShapeLayers further is doable, but a little fiddly. So, I've got a couple of questions:

  1. Is there a maximum size constraint for CAShapeLayers? Why does it not apply to the layer's image contents?
  2. Why are the CAShapeLayers re-drawing during a zoom pinch inside a UIScrollView? Shouldn't the whole zoom view (the UIScrollView's immediate child) be rasterised during the inch? How can I make it so?
+1  A: 

It turns out that the maximum area on my computer (a 2006 MacBook) is 1024*1024.

A full screen shape on the iPad is 1004 pixels heigh, giving a maximum width of about 1044 pixels, for example if you want a large shape in a horizontal scroll view.

When pinch bounce zooming, the actual height of the shape gets larger, pushing the maximum width down to about 250 pixels. This is narrower than I'd like, but doable.

This might be different on a physical iPad, but these are the limits in the simulator on my dev box.

Douglas