UILabel没有动画

时间:2014-03-20 19:18:58

标签: animation uiview uilabel

我想要一个标签在应用程序启动时动画,但它不起作用

-(void)viewDidLoad
{
    [super viewDidLoad];

    [self  LaunchApp];
}

-(void)LaunchApp
{

    CGRect frame = _mylabel.frame;
    frame.origin.y = 100; 

    [UIView animateWithDuration: 1.5
                          delay:0.0
                        options:UIViewAnimationCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState
                     animations:^ {

                         [_mylabel setFrame:frame];

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

2 个答案:

答案 0 :(得分:0)

您是使用xib或interfaceBuilder创建视图吗?

如果是这样,请尝试选择xib并取消选择使用autoLayout

enter image description here

答案 1 :(得分:0)

加载视图控制器视图后调用

viewDidLoad但此时屏幕上不显示该视图。 您可能想要订阅UIApplication个通知之一。请阅读有关应用程序状态转换https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html的文档,以获取您真正需要的内容。

相关问题