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 8774559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:35:56+00:00 2026-06-13T18:35:56+00:00

I have used the UIPageViewController for loading around 5 images in a webview. So

  • 0

I have used the UIPageViewController for loading around 5 images in a webview.
So whenever the below line of code

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

, is called, the return object is a class object(in my case class name is LoadPage). Everything works fine in my code, but I am facing some weird problem here and little uncomfortable.

So I planned to move to single class instead of two.

Now the return type for this method will be self.

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController
{
    return self;

}

Am I right?

But When I try to initialize the UIPageViewController, the application is getting crashed at one particular line.

- (void) createViewControllers {

    self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options: nil];

    pageViewController.delegate = self; 
    pageViewController.dataSource = self;

    NSArray*    nextScreens = [NSArray arrayWithObject:self];
    [pageViewController setViewControllers: nextScreens direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];

    [self addChildViewController:pageViewController];
    [self.view addSubview:pageViewController.view];
    [[self view] addSubview:[pageViewController view]];     //CRASH
    [pageController didMoveToParentViewController:self];

    CGRect pageViewRect = self.view.bounds;
    pageViewRect = CGRectInset(pageViewRect,0, 0);
    pageViewController.view.frame = pageViewRect;    

    self.view.gestureRecognizers = pageViewController.gestureRecognizers; 

}
  • 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-13T18:35:57+00:00Added an answer on June 13, 2026 at 6:35 pm

    You cannot return self in pageViewController:viewControllerAfterViewController because that would produce a cycle in the view controller hierarchy.

    You add the pageViewController as child view controller to self and then later the pageViewController adds self as child view controller (page) to itself. Thats not allowed!

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

Sidebar

Related Questions

I have used the below function to store images locally in a folder created
(UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation this delegate is not calling ........ i have also used NSDictionary
I have used the code below to run cmd commands from java (code adopted
I have used the code below to create a row of image holders which
I have used this code (kind of tutorial) at http://code.google.com/p/gwt-examples/wiki/gwt_hmtl5 ... In this code,
I have used several looking glass tools from servers around the world. What I'm
i have used the following xml code to create the layout. <?xml version=1.0 encoding=utf-8?>
I have used an UIPageViewController i want to display the 24 pages and each
I have used jQuery library to find out height of a div . Below
Have used google maps dozens of times but cannot get around this one. Doing

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.