I knew I was going to want to do something like that myself so created a small 
test project.

You need to have the scrollview, the clipview, and the document view all layer 
backed for it to work with the scrollview magnification. You shouldn't need to 
explicitly set the autoresizesSubviews on. It should all scale just like a non 
layer-backed view, scaling the subviews with it. All that works fine if you 
don't change the bounds origin.

The subviews are positioned relative to the bounds origin, so changing the 
bounds origin positions the subviews in the place you want…but it does break 
the drawing of the view itself. 

I haven't found a way to draw a layer backed view which has its bounds origin 
shifted yet. I thought using a CGContextTranslateCTM in the drawing code would 
work, but got nowhere with that.

If I set the bounds origin to be 10,10 then my view tiles would get drawn with 
a 10px gap between them, and the drawing would start at 10,10. If I set the 
bounds origin to -10,-10, then the view tiles would be drawn with a 10px gap 
between them and the drawing would start at -10,-10 which means that there is a 
20px gap along the top and left of the view. Clearly layer backed views don't 
like to have their bounds origins shifted.

I guess the problems stem from the way the drawing code draws the content into 
the layer, but am not certain how to fix it. 

Can anyone else help with how to draw a layer backed view where the bounds 
origin has been shifted?

Regards

Gideon


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to