我正在使用带有 ARC 的 Xcode 4.4 开发一个基于页面的 iPhone 应用程序,并且已经坚持了一段时间。在某个页面上,UIImageView 手指需要向上滑动并指向某物,然后向左滑动离开屏幕。当我运行一次时,这按预期工作,但是当我翻页并返回时 - 现在有 2 个手指滑动约 0.5 秒,彼此不同步。
这是代码:
-(void)fingerSwipeUp:(UIImageView *)imageView
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[imageView setCenter:CGPointMake(213.75,355.5)];
[UIView commitAnimations];
}
-(void)fingerSwipeLeft:(UIImageView *)imageView
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[imageView setCenter:CGPointMake(-80,355.5)];
[UIView commitAnimations];
}
UIImageView *finger = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"finger.png"]];
// position finger off the screen
[finger setFrame:CGRectMake(142.5,480,152.5,243)];
[self.view addSubview:finger];
[self performSelector:@selector(fingerSwipeUp:) withObject:finger afterDelay:6];
[self performSelector:@selector(fingerSwipeLeft:) withObject:finger afterDelay:8];
非常感谢任何帮助