0

I am trying to animate Label. I want to animate like below.

enter image description here

This ZCAnimatedLabel Library (https://github.com/overboming/ZCAnimatedLabel) in objective-C I integrate this library in my project using pods. But I don't know how to implement this animation.

EDIT

Now I remove my pods and create a bridging header and put a UIView in storyboard and give ZCAnimatedLabel as its class

enter image description here

What should I write in ViewController.swift to achieve this effect in ViewDidLoad

Community
  • 1
  • 1
  • What's exactly the question? are you unable to use this library in Swift project? or are you trying to achieve this animation? – Ahmad F Aug 06 '17 at 12:45
  • The code in objective-c I don't know that language. I want to achieve this animation –  Aug 06 '17 at 12:47
  • 1
    The library is in Objective-C but this is irrelevant. You can call Objective-C code from Swift: https://stackoverflow.com/questions/24002369/how-to-call-objective-c-code-from-swift (you don't even need any bridging if you're using a pod) – Eric Aya Aug 06 '17 at 12:56
  • I know that way. Then how to create this effect in ViewController.swift I import ZCAnimatedLabel in above –  Aug 06 '17 at 12:58

1 Answers1

0

I did through pod 'ZCAnimatedLabel' and in bridging header file add #import "ZCAnimatedLabel.h"

Drag and drop UIView in your scene/xib and layout it the way you want.

import ZCAnimatedLabel 

in your UIViewController, add IBOutlet and in scene/xib change your UIView class to the type of animated label you want. For default behavior change to ZCAnimatedLabel class and to animate add below code.

self.label.animationDuration = 1 // add animation duration
self.label.animationDelay = 1 // add seconds to delay
self.label.text = "some text"
self.label.startAppearAnimation()

and to stop animation

self.label.stopAnimation()

I started animation in viewWillAppear and stopped in viewWillDisappear.

Important note: I did this in swift 5

Lion
  • 872
  • 1
  • 17
  • 43