2011-08-21 68 views
2

我有一个UIViewController应控制2周的UIImageViews淡入在没有滥用[UIView animateWithDuration]的情况下触发延迟后的方法?

我管理使用的UIView animateWithDuration方法即可制作动画,这样的:

[UIView animateWithDuration:1.5 
    animations:^{ 
     [mFrontpageTitle setAlpha:0]; 
     [mFrontpageTitle setAlpha:1]; 
    } 
    completion:^(BOOL finished){ 
     [self AnimatePause]; 
    }]; 

-(void)AnimatePause { 
[UIView animateWithDuration:5.0 
    animations:^{ 
     [mFrontpageTitle setAlpha:0.99]; 
     [mFrontpageTitle setAlpha:1]; 
    } 
    completion:^(BOOL finished){ 
     [self AnimateAuthor]; 
    }]; 

其中火灾下一个动画。现在,创建一个从.99到1.0的转换并不是很干净。

是否有更好的方法通过定义持续时间来触发块或发送消息?

感谢

Zuppa

回答

3
NSTimeInterval delay = 1.5; //in seconds 
[self performSelector:@selector(myMethod) withObject:nil afterDelay:delay]; 
+0

谢谢。我已经看到了完全错误的方向。我会看到,如果这个崩溃,如果UIView在间隔完成之前被删除.. :) – Zuppa

+0

如果我想调用一个方法,需要两个参数?例如:' - (void)MoveSomethigFrom:(id)from To:(id)to;' – Frade

+0

或者将你的方法包装在只需要一个参数的东西(例如带有所有参数的字典)中,或者使用'dispatch_after '(例子见[这里](http://stackoverflow.com/a/4139331/573626))。 – omz

相关问题