ios - iCarousel get user tapped index -
i want index user has tapped.i have tried several ways detect none of working. here have tried.
func carousel(carousel: icarousel, didselectitematindex index: int) { print("this has been tapped carousel \(index)") } func carouselcurrentitemindexdidchange(carousel: icarousel) { let index=carousel.currentitemindex print("this current index \(index) ") } func carousel(carousel: icarousel, viewforitematindex index: int, reusingview view: uiview?) -> uiview { let webv:wkwebview! webv = wkwebview(frame: cgrectmake(10, 10, 250, 250)) if let updatedresource = mydict[index+1]{//name of resource want load let url = nsbundle.mainbundle().urlforresource(updatedresource, withextension: "html") let requestobj = nsurlrequest(url: url!); webv.loadrequest(requestobj); let tapgesture = uitapgesturerecognizer(target: self , action: selector("tapdetected")) //tapgesture.numberoftapsrequired = 2 tapgesture.enabled = true webv.userinteractionenabled = true webv.addgesturerecognizer(tapgesture) // setuserinteractionenabled = true print("this has been rendered \(index)") } return webv } func tapdetected(sender:uiswipegesturerecognizer) { print("yes tap has been detected :)")
might not since i'm using objective-c tap getting detected in
- (void)didtap:(uitapgesturerecognizer *)tapgesture
method.
[_delegate carousel:self didselectitematindex:index]; nslog(@"selected app @ index: %d", index);
works expected. i'm using icarousel version 1.8.2
Comments
Post a Comment