UIView翻译后触摸问题

时间:2010-09-08 22:52:31

标签: objective-c ipad animation uiview touch

我有uiview“DummyView”并将其他两个视图“StartView”和“ShowView”并排添加到DummyView中。

当应用启动时,StartView会显示出来。在此视图上是一个UIButton,它触发一个平移动画,将StartView移动到左侧(屏幕外),将ShowView移动到屏幕中。在ShowView上,我有一个UIScrollView。

翻译动画后,我无法再滚动浏览我的UIScrollView。在将StartView移出屏幕之前,它可以完美地工作(测试它)。

这是代码。

- (void)viewDidLoad {
    [super viewDidLoad];

    [button addTarget:self action:@selector(moveIt:) forControlEvents:UIControlEventTouchUpInside];
}


- (void)moveIt:(id)sender {
    NSLog(@"Move it!");

    [UIView beginAnimations:@"Move It" context:nil];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationBeginsFromCurrentState:YES];

    CGAffineTransform transform = CGAffineTransformMakeTranslation(-1024, 0);
    self.view.superview.transform = transform;

    [UIView setAnimationDelegate:self];
    [UIView commitAnimations];

}

感谢您的建议。

1 个答案:

答案 0 :(得分:0)

动画完成后

尝试:

self.view.superview.transform = CGAffineTransformIdentity;

这应该有帮助