0
votes

I have followed the following tutorial to implement my collection view here

There is a back button implemented in the root view; however it does not receive any touch events as they are intercepted by the pageContentViewController.

From stackoverflow I have found the current thread of discussions which deal with a similar topic here. There is the following solution:

for (UIGestureRecognizer *gR in self.view.gestureRecognizers) {
    gR.delegate = self;
}

However, it does not work as there is no gestureRecognizers as my pageViewController is in scroll mode; not curl. I cannot find any other solutions which do not point towards the code above.

What would be then the approach for the scroll mode? Any hint is highly appreciated!

1
please post the code for the whole view controller classNitin Alabur

1 Answers

0
votes

The code was pretty similar to the one mentioned in the tutorial here

I've finally come around the problem by creating a tap gesture in the view of the pagecontentviewcontroller. The main idea is to capture the tap event, gets its tap location and compare it with the boundaries of the back button outlet of the parentviewcontroller as below:

- (IBAction)TapGestureOnPageContentView:(id)sender {

// get the tapped point from the sender
CGPoint tapPoint = [sender locationInView:self.view];

// retrieve the dimension from the back button; outlet reference imported from RootViewController
//
CGRect rectangle = backButton.bounds;
CGPoint center = backButton.center;

int width= rectangle.size.width /2;
int height = rectangle.size.height /2;

if ((tapPoint.x >= (center.x - width))
    && (tapPoint.x <= (center.x + width))

    &&(tapPoint.y >= (center.y - height))
    && (tapPoint.y <= (center.y + height))
    )
        {
            UIStoryboard* mainStoryBoard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
            WizzMainScreenController* vc = [mainStoryBoard instantiateViewControllerWithIdentifier:@"WizzMainScreen"];
            [vc setCentralUIManager:centralUIManager];        
            [self presentViewController:vc animated:YES completion:nil];   
        }
}

The code above works fine for me, hope it helps you too!