2013-05-21 50 views
1

我在MyUILabel上执行2个动画。 MyUILable是我从UILabel派生而来的自定义类,并已实现 drawRect方法,该方法仅绘制边框。动画后出现线UILabel

这是我的动画代码:

- (void)animateLableIn 
{ 
    UIViewAnimationOptions options = UIViewAnimationOptionBeginFromCurrentState|UIViewAnimationOptionAllowUserInteraction; 
    [UIView animateWithDuration:0.1f delay:0.0 options:options animations:^{ 

     label.transform = CGAffineTransformMakeScale(1.1f, 1.1f); 

    } completion:^(BOOL finished) { 
     if (finished) { 
      [self animateLableOut]; 
     } 
    }]; 
} 

- (void)animateLableOut 
{ 
    UIViewAnimationOptions options = UIViewAnimationOptionBeginFromCurrentState|UIViewAnimationOptionAllowUserInteraction; 
    [UIView animateWithDuration:0.1f delay:0.0 options:options animations:^{ 

     label.transform = CGAffineTransformMakeScale(1.0f, 1.0f); 

    } completion:^(BOOL finished) { 
     if (finished) { 
     } 
    }]; 
} 

在第一动画灰线出现在我的标签的顶边和所有动画完成后仍然存在的开始。 我想提一下,这一行不是我的drawRect实现的一部分,即使我的drawRect为空,它也会出现。 此外,标签稍微小一些,但最初是这样。

所附图片不成比例。

动画之前:

Before animations

后的动画:

After animations

任何猜测为什么会发生呢?

+1

我有一个类似的问题,并使用小数。字体难以渲染。与1.1玩一场 – Vertig0

回答

0

最后我发现了这个问题。 我在动画运行时更改了该标签的框架。 动画完成后,更改标签的框架可以解决问题。