0
votes

i am facing problem, i don't know how to achieve this give me any solution.

UIView ----UIScrollview ------Imageview (minimum 10)

Every Imageview added into scrollview, and every ImageView contains UITapgesture recongizer.Tapgesture used to take the image and show into Nextviewcontroller as enlarged.

Here i am facing problem, when i scrolling the UIScrollview i want to stop scrolling right over there by touching inside or somewhere of scrollview.If i touch anywhere, its going next page.

In the page, if the UIScrollview is scrolling (without the user currently touching the screen) and then the user taps the screen, the screen should stop but no Imageview should be enlarged. Currently the screen stops, but the clicked picture is being enlarged.

Code so far...

 UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapAction:)];
        singleTap.numberOfTapsRequired = 1;
        singleTap.delegate = self;
        singleTap.cancelsTouchesInView = NO;
        hypeScroll.canCancelContentTouches = NO;


- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    //return YES;

//    if (gestureRecognizer.view.superview.tag == hypeScroll.tag) {
//        return NO;
//    }
    return YES;

}

Give me solution, i have stuck in long time,

thanks in advance

1
Your image view covering entire scrollview or is there any space to click on scrollview? - Dharmbir Singh
yes its covering entire scrollview. only 2px space between two images.. - karthikeyan
I suggest UICollectionView to achieve this kind of stuff!! - Ketan Parmar

1 Answers

0
votes

I think UICollectionView will be more helpful for you in achieving this functionality rather than relying on UIScrollView. Check out UICollectionView.