3

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?

4

1 回答 1

10

2天后这个问题

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];

秘诀就是调用[CALayer display]方法

于 2014-01-05T02:05:36.783 回答