Reputation: 12003
I would like to use a CATextLayer
to display some partially bolded text in the form of a NSAttributedString
- but would still like to use the convenience of IB for positioning.
Is there a way to drop in a CATextLayer
with interface builder? Or what is the next best solution?
Upvotes: 0
Views: 360
Reputation: 9185
You could configure a UIView
subclass in IB then set its layerClass
to CATextLayer
in code:
+ (Class)layerClass;
{
return [CATextLayer class];
}
In the view's init
method(s) configure your CATextLayer
properties.
To access the layer's properties:
CATextLayer *textLayer = (CATextLayer *)self.layer;
textLayer.string = @"Foo";
// etc...
Upvotes: 3