用touchesBegan来给页面上的子控件添加点击事件

-(void)touchesBegan:(NSSet*)touches withEvent:(UIEvent *)event

{

[super touchesBegan:touches withEvent:event];

CGPoint point = [[touches anyObject] locationInView:_label];

if ([_label pointInside:point withEvent:event]) {

NSLog(@"%f",point.x);

}

}

你可能感兴趣的:(用touchesBegan来给页面上的子控件添加点击事件)