iphone - Detecting touches for layers within a UIScrollView -
i have uiscrollview contains number of thumbnails should detect touch event, perform 3d transformation on , call delegate method.
the 1 problem unable overcome detecting sublayer being tapped. setting layer.name index count , subclass of uiscrollview touch event. last remaining obstacle how hittest on sublayers name property , voila!
i thinking of subclassing uiview container of calayer , capturing touch event way. hoping there might more economical way determine sublayer being touched.
the code have been trying (in uiscrollview subclass):
-(void)touchesbegan:(nsset *)touches withevent:(uievent *)event {     if ([touches count] == 1) {         (uitouch *touch in touches) {              cgpoint point = [touch locationinview:[touch view]];             calayer *alayer = [self.layer hittest:point];             if (alayer) nslog(@"layer %@ touched",alayer.name);             else nslog(@"layer not detected");          }      }  }   i getting 2 compile errors. first warning: no hittest method found. , error "request member 'name' not structure or union".
call [scrollview.layer hittest:touchpoint];. return value layer touched. if returned layer equal scrollview.layer, no sublayer tapped.
Comments
Post a Comment