FROM : Aaron Tait
DATE : Sun Nov 18 09:00:09 2007
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];
The method is as follows:
-(void)addFileNameLayer:(NSString *)fileName
{
CATextLayer * fileNameLayer = [CATextLayer layer];
fileNameLayer.string = fileName;
fileNameLayer.name = @"fileNameLayer";
fileNameLayer.fontSize = 14.0;
fileNameLayer.alignmentMode = kCAAlignmentCenter;
fileNameLayer.wrapped = YES;
fileNameLayer.anchorPoint = CGPointMake(0.5, 0.5);
fileNameLayer.bounds = CGRectMake(0, 0, 320, 50);
[fileNameLayer addConstraint:[CAConstraint
constraintWithAttribute:kCAConstraintMidX relativeTo:@"superlayer"
attribute:kCAConstraintMidX]];
[fileNameLayer addConstraint:[CAConstraint
constraintWithAttribute:kCAConstraintMidY relativeTo:@"superlayer"
attribute:kCAConstraintMidY offset:-100]];
[self.layer addSublayer:fileNameLayer];
}
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.
-Aaron
DATE : Sun Nov 18 09:00:09 2007
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];
The method is as follows:
-(void)addFileNameLayer:(NSString *)fileName
{
CATextLayer * fileNameLayer = [CATextLayer layer];
fileNameLayer.string = fileName;
fileNameLayer.name = @"fileNameLayer";
fileNameLayer.fontSize = 14.0;
fileNameLayer.alignmentMode = kCAAlignmentCenter;
fileNameLayer.wrapped = YES;
fileNameLayer.anchorPoint = CGPointMake(0.5, 0.5);
fileNameLayer.bounds = CGRectMake(0, 0, 320, 50);
[fileNameLayer addConstraint:[CAConstraint
constraintWithAttribute:kCAConstraintMidX relativeTo:@"superlayer"
attribute:kCAConstraintMidX]];
[fileNameLayer addConstraint:[CAConstraint
constraintWithAttribute:kCAConstraintMidY relativeTo:@"superlayer"
attribute:kCAConstraintMidY offset:-100]];
[self.layer addSublayer:fileNameLayer];
}
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.
-Aaron
| Related mails | Author | Date |
|---|---|---|
| Aaron Tait | Nov 18, 09:00 | |
| Bill Dudney | Nov 18, 14:26 | |
| Aaron Tait | Nov 18, 19:02 | |
| Scott Anguish | Nov 19, 10:12 | |
| Paul Arthur Henrio… | Nov 22, 16:53 |






Cocoa mail archive

