多点触摸的简单示例

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
	touchLabel.text = @"Touches Began";
}

- (void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{
	touchLabel.text = @"Touches Cancelled";
}

- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
	touchLabel.text = @"Touches Stopped";
}

- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
	touchLabel.text = @"Drag detected";
}

 

需要注意的是:在Interface Builder中,必须将view的属性Interaction里的两项User Interaction Enabled和Multiple Touch都勾上。

你可能感兴趣的:(ios,多点触摸,iPhone)