Garoal
Garoal

Reputation: 2374

Mix CATextLayer and CAScrollLayer

I need a scrollable CATextLayer to display a NSAttributedString. Is there any way to mix both layers, or to add a scroll to CATextLayer or to display text in a CAScrollLayer?

Sorry if the question isn't very exact. Thanks!

EDIT: I haven't seen that the CALayer is scrollable. Sorry!

Upvotes: 0

Views: 381

Answers (2)

Naresh
Naresh

Reputation: 433

Try adding this to your example to scroll the layer programmatically:

- (void)scroll {
    [scrollLayer scrollToPoint:scrollPoint];
    scrollPoint.x += 10;
    [self performSelector:_cmd withObject:nil afterDelay:0.1];
}

and add this at the end of the initialize method:

scrollPoint = CGPointMake(0, 0);
[self scroll];

Upvotes: 1

Garoal
Garoal

Reputation: 2374

CALayer (and CATextLayer) can be scrolled

Upvotes: 0

Related Questions