Question

I'm working on a video app that generates a credits clip using a .mov resource as the background and a CATextLayer for the credits. The code works in iOS 5 and 6, but not in iOS 7 - ie: the clip gets generated but text does not appear.

I've tried using the code from the answer to this question (How can I add overlay text on a video, then re-encode it?), but the text in the CATextLayer still does not show up.

Why is iOS 7 behaving differently and how can I get it to work?

Was it helpful?

Solution

After 2 days on this problem

CATextLayer *text = [CATextLayer layer];
text.string = @"Your Text";
text.frame = CGRectMake(0, 0, 320, 50);
CGFontRef font = CGFontCreateWithFontName((CFStringRef)@"HelveticaNeue-UltraLight");
text.font = font;
text.fontSize = 20;
text.foregroundColor = [UIColor whiteColor].CGColor;
[text display];
[aLayer addSublayer:text];
[aLayer display];

The secret is calling [CALayer display] method

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top