UIView 翻译后的触摸问题
我有 uiview“DummyView”,并在 DummyView 中并排添加了另外两个视图“StartView”和“ShowView”。
当应用程序启动时,将显示 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];
}
谢谢你的建议。
i have uiview "DummyView" and added two other views "StartView" and "ShowView" side-by-side into the DummyView.
When the app starts the StartView shows up. On this view is a UIButton, which triggers a translation animation to move the StartView to the left (out of the screen) and the ShowView into the Screen. On the ShowView, I have a UIScrollView.
After the translation animation I can't scroll through my UIScrollView any longer. Before moving StartView out of the screen it works perfectly (tested it).
Here's the code.
- (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];
}
Thanks for advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
动画完成后尝试:
这应该有帮助
after animation completion try:
this should help