Skip navigation.
 
mlRe: CAScrollLayer "Contents" Size
FROM : Scott Stevenson
DATE : Thu Mar 13 04:08:38 2008

On Mar 12, 2008, at 6:15 PM, Matt James wrote:

> I guess I was thinking from an HTML perspective of adding an image 
> within a
> div and how the div grows automatically to contain the image.  I can
> understand not clipping, but it seems counter-intuitive that a 
> "superlayer"
> can contain something larger than itself and not "grow" in response.


It probably has something to do with the fact that CSS was designed 
for page layout and Cocoa and Core Animation were designed for 
application user interfaces. Also, Core Animation has different 
considerations for OpenGL text size limits.

FWIW, child divs can also exist outside of their parents in some 
cases, such as when you use negative margins or if you apply a float 
attribute on the child. But that's probably nitpicking.  :)

If you do want a parent CALayer to clip the sublayers, you can do this:

   superLayer.masksToBounds = YES;

This also clips out the shadows, though.


    - Scott

Related mailsAuthorDate
mlCAScrollLayer "Contents" Size Matt James Mar 11, 17:18
mlRe: CAScrollLayer "Contents" Size Scott Stevenson Mar 11, 23:25
mlRe: CAScrollLayer "Contents" Size Matt James Mar 12, 02:34
mlRe: CAScrollLayer "Contents" Size Scott Stevenson Mar 12, 06:07
mlRe: CAScrollLayer "Contents" Size Matt James Mar 12, 12:56
mlRe: CAScrollLayer "Contents" Size Matt James Mar 12, 13:06
mlRe: CAScrollLayer "Contents" Size Scott Stevenson Mar 12, 23:15
mlRe: CAScrollLayer "Contents" Size Matt James Mar 13, 02:15
mlRe: CAScrollLayer "Contents" Size Scott Stevenson Mar 13, 04:08
mlRe: CAScrollLayer "Contents" Size Scott Stevenson Mar 13, 04:11