從我身邊我會嘗試波紋管代碼,但它不工作。我想刪除手勢,當我點擊一個類的對象
- (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!請提供除「不能工作」之外的更多具體信息。 –