簡體   English   中英

如何使用 ZCAnimatedLabel 為標簽文本設置動畫?

[英]How to animate label Text using ZCAnimatedLabel?

ZCAnimatedLabel 擴展了 UIView,因為 UILabel 類不能重新指向 ZCAnimatedLabel。 使用 ZCAnimatedLabel 為標簽文本設置動畫的正確方法是什么?

如果您對 CocoaPods 庫有疑問,請先查看 git repo 以了解如何使用它。 ZC動畫標簽

嘗試這個 :

ZCAnimatedLabel *label;
label.animationDuration = 1;
label.animationDelay = 1;
label.text = @"AnimateLabel";
// add animation type
object_setClass(label, [ZCAnimatedLabel class]);
// start Animation
[label startAppearAnimation];

停止動畫:

[self.label startDisappearAnimation];

您可以添加到標簽的不同類型的動畫:

//Throw
object_setClass(label, [ZCThrownLabel class]);
//Shapeshift
object_setClass(label, [ZCShapeshiftLabel class]);
//Default
object_setClass(label, [ZCAnimatedLabel class]);
//Duang
object_setClass(label, [ZCDuangLabel class]);
//Fall
object_setClass(label, [ZCFallLabel class]);
//Alpha
object_setClass(label, [ZCTransparencyLabel class]);
//Flyin
object_setClass(label, [ZCFlyinLabel class]);
//Blur
object_setClass(label, [ZCFocusLabel class]);
//Reveal
object_setClass(label, [ZCRevealLabel class]);
//Spin
object_setClass(label, [ZCSpinLabel class]);
label.layerBased = YES;
//Dash
object_setClass(label, [ZCDashLabel class]);
label.layerBased = YES;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM