首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

UIControl和UIView的事件传递有关问题

2013-11-01 
UIControl和UIView的事件传递问题对于UIControl子类中的- (-(传递中子类监听touchbegin,传递回来给UIContr

UIControl和UIView的事件传递问题

对于UIControl子类中的

- (-(

传递中子类监听touchbegin,传递回来给UIControl子类,UIControl子类只能监听对于的touchesBegan,而没有触发beginTracking.


解决方案:

在UIControl子类调用

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{    NSLog(@"my control touch begin");    [super touchesBegan:toucheswithEvent:event];    UITouch* touch = [touches anyObject];    // Track the touch    [self beginTrackingWithTouch:touch withEvent:event];}- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event{    [super touchesMoved:toucheswithEvent:event];    // Get the only touch (multipleTouchEnabled is NO)    UITouch* touch = [touches anyObject];    // Track the touch    [self continueTrackingWithTouch:touch withEvent:event];}....end



热点排行