简体   繁体   中英

CATextLayer not visible on video in iOS7

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM