在我的应用程序中,我创建了一个UiLabel。我必须根据触摸手势向右移动标签,就像滑出菜单一样。请帮帮我。
发布于 2013-01-21 15:49:51
您可以使用UITapGestureRecognizer:
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
[label addGestureRecognizer:singleTap];然后在你的方法中使用UIViewAnimation:
- (void)handleSingleTap:(UITapGestureRecognizer *)recognizer {
CGRect frame = label.frame;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
frame.origin.x += 100; // slide right
label.frame = frame;
[UIView commitAnimations];
}https://stackoverflow.com/questions/14434301
复制相似问题