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

webView 组合js 获取 touch 坐标

2013-02-05 
webView 结合js 获取 touch 坐标- (id)init{self [super init]if (self) {UITapGestureRecognizer* sin

webView 结合js 获取 touch 坐标

- (id)init{

    self = [super init];

    if (self) {

        

       UITapGestureRecognizer* singleTap = [[UITapGestureRecognizeralloc]initWithTarget:selfaction:@selector(handleSingleTap:)];

        [selfaddGestureRecognizer:singleTap];

        singleTap.delegate =self;

        singleTap.cancelsTouchesInView =NO;

        [singleTap release];

    }

   returnself;

}


//webView 不响应touch 时间

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

    [supertouchesBegan:toucheswithEvent:event];

   CGPoint superPoint = [[touchesanyObject]locationInView:self.superview];

   CGPoint point = [[touchesanyObject]locationInView:self];

    NSLog(@"super %f,%f",superPoint.x,superPoint.y);

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

}


- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{

   returnYES;

}


-(void)handleSingleTap:(UITapGestureRecognizer *)sender{

    CGPoint point = [sender locationInView:self];

   NSLog(@"handleSingleTap!pointx:%f,y:%f",point.x,point.y);

}

热点排行