【发布时间】:2014-10-11 11:35:22
【问题描述】:
我有一个 UIImageView,它在视图加载时移动。 它首先会向上 +100,然后将 a BOOL 设置为已完成。
当 BOOL 设置为完成时,它将执行另一个动画,将 UIImageView 放回其原始位置。当我的 UIImageView 然后回到原来的位置时,它应该重新开始整个事情。这种重复应该永远持续下去!我该怎么做?
这是我的代码:
[UIView animateWithDuration:0.5
animations:^
{
//move up
Person.center = CGPointMake(Person.center.x, Person.center.y +100);
}
completion:^(BOOL completed)
{
if (completed)
{
//completed move up..now move down
[UIView animateWithDuration:0.5
animations:^
{
Person.center = CGPointMake(Person.center.x, Person.center.y -100);
}
];
}
}];
【问题讨论】:
-
我添加了答案,请检查....
标签: ios objective-c xcode uiimageview