0

I'm using UIView animateKeyframesWithDuration to achieve the following "change the layout of a component to expand with a text". Initially, the component is just a big dot without any text, with animation it expands exposing letters as it is expanding to say "TEST". So it expands from right to left, exposing "t", "e", "s", "t" in this order. I want to do this animation in 300 ms. Code for reference -

[self.view.superview.superview layoutIfNeeded];
[UIView animateKeyframesWithDuration:0.3
                                   delay:0
                                 options:0
                              animations:^{
        [UIView addKeyframeWithRelativeStartTime:0 relativeDuration:1 animations:^{
            [self.view.superview.superview layoutIfNeeded];
        }];
        [UIView addKeyframeWithRelativeStartTime:0.05 relativeDuration:1 animations:^{
            label.alpha = 1;
        }];

However, the problem is when I measure the time that it is actually taking, it ranges from 1ms to 7ms. Why is the time of animation not reflecting and how can I achieve it smoothly?

Usecase similar to UIView Animation happens faster than specified seconds. Already tried the answer mentioned here.

Satakshi Pandey
  • 169
  • 3
  • 8

0 Answers0