This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 305
Dynamic Text
PonyCui edited this page Dec 20, 2018
·
1 revision
You may add text above an element just like this.
You can download a sample file from SVGA-Samples to try.
// Setup a SVGAPlayer by yourself.
SVGAParser *parser = [[SVGAParser alloc] init];
[parser parseWithURL:[NSURL URLWithString:@"https://github.com/yyued/SVGA-Samples/blob/master/posche.svga?raw=true"] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
} failureBlock:nil];
NSAttributedString *text = [[NSAttributedString alloc] initWithString:@"Pony send Kitty flowers."
attributes:@{
NSForegroundColorAttributeName: [UIColor whiteColor],
NSFontAttributeName: [UIFont boldSystemFontOfSize:28.0],
}];
[...aPlayer setAttributedText:text forKey:@"banner"];
The imageKey
is the name of png file, ask your designer tell you the file name.
For example, the layer png image file name is xxx.png
, imageKey
is xxx
. File name should always use English name, do not use Chinese or Japanese etc.