【发布时间】:2015-05-05 05:56:42
【问题描述】:
就我而言,我会尝试下面的代码,但它不起作用。
- (void) handleTouch:(UITapGestureRecognizer *) gesture
{
CGPoint touchPoint = [gesture locationInView:self.view];
NSArray *viewsAtPoint = [self viewsAtPoint:touchPoint];
for(TheifView * aView in viewsAtPoint)
{
[aView removeFromSuperview];
}
}
- (void) registerGesture
{
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTouch:)];
tapGesture.numberOfTapsRequired = 1;
[self.view addGestureRecognizer:tapGesture];
}
【问题讨论】:
-
欢迎来到 StackOverflow!除了“不工作”之外,请提供更具体的信息。
标签: ios objective-c iphone ios7 ios5