Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8643119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:57:14+00:00 2026-06-12T11:57:14+00:00

This has only started happening with ios6, but if you start a new project

  • 0

This has only started happening with ios6, but if you start a new project using the page view controller template. Then in

PCRootViewControlle::viewDidLoad()

add the lines to the bottom of the method.

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

You’ll need to assign the viewController so it conforms to the UIGestureRecognizerDelegate and implement the method

-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch (UITouch *)touch
{
    return YES;
}

Now if you run the app and try to turn the page beyond the bounds, i.e. go to January and try to turn back so

  • (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController

returns nil.

The app will then crash.

This did not happen with ios5. I need to assign the gestureRecognizer delegate to my viewController because I do not always want the pageViewController to handle the touch events.

Has any else experienced this or point out If I am doing something wrong?

Many Thanks
Stewart.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:57:16+00:00Added an answer on June 12, 2026 at 11:57 am

    Finally found a solution to my problem which has caused me grief so hopefully this can help someone else.

    The issue is if you set the pageViewControllers delegate to your viewController

    for (UIGestureRecognizer *gR in self.pageController.view.gestureRecognizers) 
    {
        if ([gR isKindOfClass:[UITapGestureRecognizer class]])
        {
            gR.enabled = NO;
        }
        else if ([gR isKindOfClass:[UIPanGestureRecognizer class]])
        {
            gR.delegate = self;
        }
    }
    

    then returning nil from

    pageViewController:viewControllerAfterViewController:
    

    will crash!! only in iOS6!!

    My issue was that I needed to set the delegate of the gestureRecognisers because I needed to intercept the panGesture in some situations, i.e not allowing the user to turn a page wilst touching certain parts of it due to some buttons there.

    The solution is to put the logic from

    pageViewController:viewControllerAfterViewController: 
    

    into

    gestureRecognizer:shouldReceiveTouch:
    

    because as long as we return NO from that then it wont go on to call

    pageViewController:viewControllerAfterViewController:
    

    and so no need to return nil and get a crash.

    However, this didn’t work on the first and last page in the sequence. For example on the first page, you want to allow the page to turn forward but not back. So I thought about looking at the GestureRecogniser passed in, casting it to a PanGesture, and then checking the velocity on this, if the velocity signifies turning back ( > 0.0f ) then just return NO. This sounded good but the velocity was always zero.

    I then found a very helpful little function on the GestureRecognizer delegate called:

    gestureRecognizerShouldBegin:gestureRecognizer
    

    this function is called after

    gestureRecognizer:shouldReceiveTouch:
    

    but this time the velocity from the gesture is as I expected, so I can check the velocity and only return YES for the first page if it is > 0.0f

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This problem has only cropped up recently, but I couldn't find any reference to
I have MySQL InnoDB table utf-8 encoded. This table has only id and name
Assume i have a custom Windows application written in C#. This application has only
I want to make sure a string has only characters in this range [a-z]
How does one do this? The SYSCOLUMNS system table only has columns for tables.
My only guess is something horrible like this: # files where something has been
This has been frustrating me for a while now. I started developing a site
This has probably something to do with my transformations, but right now I can't
this has baffled me for a couple of hours now. Why do i get
this has been an ongoing problem with me, ive been trying to make a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.