【发布时间】:2014-02-01 21:33:35
【问题描述】:
我想制作一个动画,就像 Facebook 在其应用程序的早期版本中使用的那样,其中标题出现在中心,1 或 2 秒后它会上升几个像素,以便有一些空间用于登录或某事,问题是动画没有像我想要的那样工作,我留下我的代码,所以你可以看到什么是错的......谢谢!
- (void)viewDidLoad
{
self.view.backgroundColor = [UIColor colorWithRed:51/255.0f green:204/255.0f blue:102/255.0f alpha:1.0];
self.LogoImageView.center = self.view.center;
if ([[UIScreen mainScreen] bounds].size.height == 568)
{
//IPHONE 4 i
self.LogoImageView.frame = CGRectMake(33, 156, 255, 255);
}else
{
//IPHONE 3.5 i
self.LogoImageView.frame = CGRectMake(33, 112, 255, 255);
}
double delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[UIView animateWithDuration:1.0 delay:.35 usingSpringWithDamping:.10 initialSpringVelocity:.50 options:UIViewAnimationOptionCurveEaseInOut animations:^{
if ([[UIScreen mainScreen] bounds].size.height == 568)
{
//iphone 5 image
self.LogoImageView.frame = CGRectMake(33, 48, 200 , 200);
}else
{
self.LogoImageView.frame = CGRectMake(33, 48, 200, 200);
}
} completion:nil];
});
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
【问题讨论】:
标签: ios facebook animation uiview dispatch