• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CALayer autoresizing behaviour
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CALayer autoresizing behaviour


  • Subject: CALayer autoresizing behaviour
  • From: Joe Wildish <email@hidden>
  • Date: Wed, 21 Jan 2009 13:10:00 +0000

All,

I'm having trouble getting a CALayer to resize automatically to fill its superlayer. I have the following code snippet:

layer = [CALayer layer];
layer.layoutManager = [CAConstraintLayoutManager layoutManager];
layer.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable;


    object.frame = CGRectMake(0.0f, 0.0f, 100.0f, 100.0f);
    [object addSublayer:layer];

    NSLog(@"object.frame=%@,\nlayer.frame=%@",
        NSStringFromRect(NSRectFromCGRect(object.frame)),
        NSStringFromRect(NSRectFromCGRect(layer.frame)));

(NB: "object" is an instance of a CALayer).

It was my understanding that with the options that I've used for the autoresizing mask on "layer", it should be resized to be the same size as its super-layer. However, the output on the console indicates otherwise:

2009-01-21 13:03:31.538 TheAppName[37894:10b] object.frame={{0, 0}, {100, 100}},
layer.frame={{0, 0}, {0, 0}}


I thought that it might be that the change was in a state of animation at the point of the NSLog, but the actual visual output I'd expect from my app also indicates that the resize hasn't occurred.

Is anyone able to point out what I'm doing wrong?

Many thanks,
-Joe
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: CALayer autoresizing behaviour
      • From: "Michael A. Crawford" <email@hidden>
  • Prev by Date: Re: Format float value to display with commas
  • Next by Date: Setting the result of a javascript function to NSString
  • Previous by thread: Re: Format float value to display with commas
  • Next by thread: Re: CALayer autoresizing behaviour
  • Index(es):
    • Date
    • Thread