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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:07:06+00:00 2026-06-11T20:07:06+00:00

I’m trying to implement a page-scroll functionality in my project. I develop for iOS

  • 0

I’m trying to implement a page-scroll functionality in my project. I develop for iOS 5, with storyboards (and ARC). This is what I did in my storyboard :

enter image description here

The first viewController (on the left) has a scrollView and a pageControl. Its class is called GlobalDashboardViewController, and inherits from the class DashboardViewController (which inherits from UIViewController). The other 2 controllers are simple UIViewControllers with identifiers (MainDashboard and SecondaryDashboard).

In GlobalDashboardViewController.m, there is only a viewDidLoad, which gets the childViewControllers :

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"MainDashboard"]];
    [self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"SecondaryDashboard"]];
}

DashboardViewController.m is a bit more complex. Here are the most important methods :

- (void)viewDidLoad
{
    // Calling the viewDidLoad above to populate the childViewControllers array
    [super viewDidLoad];

    [self.scrollView setPagingEnabled:YES];
    [self.scrollView setScrollEnabled:YES];
    [self.scrollView setShowsHorizontalScrollIndicator:NO];
    [self.scrollView setShowsVerticalScrollIndicator:NO];
    [self.scrollView setDelegate:self];
}


-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    self.pageControl.currentPage = 0;
    _page = 0;
    [self.pageControl setNumberOfPages:[self.childViewControllers count]];

    UIViewController *viewController = [self.childViewControllers objectAtIndex:self.pageControl.currentPage];
    if (viewController.view.superview != nil) {
        [viewController viewWillAppear:animated];
    }

    self.scrollView.contentSize = CGSizeMake(scrollView.frame.size.width * [self.childViewControllers count], scrollView.frame.size.height);
}

There are plenty of other methods, but I don’t think they’re relevant, because here is my problem: the app launches, and I see the scrollView and the pageControl. The background is dark gray, as I set it in the GlobalDashboard viewController. I can scroll correctly, and the pageControl is updated. But I don’t see the other views. When I place a breakpoint at the if in viewWillAppear, and look at viewController, it’s named correctly (Dashboard Page 1, which is the name I gave to the controller in the storyboard), but its _view property shows 0x00000000, as you can see here :

enter image description here

So, I never get inside the if, which is where some of the magic of actually showing the viewControllers happens…

My work is based on an example project you can find here : PageViewController. When I run it, it works perfectly. I have no clue why I can’t make it work in my own project.

Any ideas ?

Thanks

  • 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-11T20:07:07+00:00Added an answer on June 11, 2026 at 8:07 pm

    You never add the view itself ([self.view addSubview:/*Your child controller's view*/]). The project you linked to does it in - (void)loadScrollViewWithPage:(int)page inside PagerViewController.m

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:

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.