Bill, I tried your solution but it did not help. Fortunately however,
I have found a working solution. It looks like the constraints mess
with the sizing and bounds of my CATextLayer making it only 1 unit in
size. I have added the following constraint and it produces a
desirable result:
[fileNameLayer addConstraint:[CAConstraint
constraintWithAttribute:kCAConstraintWidth relativeTo:@"superlayer"
attribute:kCAConstraintWidth]];
-Aaron
On 18-Nov-07, at 8:26 AM, Bill Dudney wrote:
Hi Aaron,
When trying to manipulate layers like this its best if you use a
layer hosting view rather than a layer backed view. If you rely on
the layer the view creates for you its often the case that you get
weird behavior like this.
Instead in your awakeFromNib method you can make your view layer
hosting;
myLayer = [CALayer layer];
// other myLayer initilization
[myView setLayer:myLayer];
[myView setWantsLayer:YES];
then you can add sublayers as in your addFileNameLayer: below and
everything should work.
As an alternative you could simply create a text field as a label
and add it as a subview of your current setup and it will become
layer backed since you are adding it to a view that is layer backed.
I've been pulling my hair out trying to get a CATextLayer to work
with a couple of CAConstraints. The following is a method
implemented in a layer backed view and the following call is made
in the view's awakeFromNib:
self.layer.layoutManager = [CAConstraintLayoutManager layoutManager];
When the code executes, it displays nothing. I also add another
plain old CALayer before I call this method with similar
constraints and it works out fine. Anyone help would be appreciated.