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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:44:16+00:00 2026-05-26T17:44:16+00:00

I have two UIViewControllers each with their own nib files. Each controller serves a

  • 0

I have two UIViewControllers each with their own nib files. Each controller serves a different purpose. The idea was to add a UIScrollController and add both UIViewControllers to it so the user can easily scroll between them both.

Q1) Is this even possible? Or have I got the whole purpose of UIScollControllers incorrect, if so, what is the best alternative.

I have been poking around the internet and the best I can come up with is this:

ScoreViewController *scoreController = [[ScoreViewController alloc] initWithNibName:@"ScoreViewController" bundle:nil];
scoreController.view.frame = CGRectMake(0.0f, 0.0f, 960f, 640f);
[self.scrollview addSubview:scoreController.view];
[scoreController release];

SettingsViewController *settingsController = [[SettingsViewController alloc] initWithNibName:@"SettingsViewController" bundle:nil];
settingsController.view.frame = CGRectMake(0.0f, 0.0f, 960f, 640f);
[self.scrollview addSubview:settingsController.view];
[settingsController release];

This code is entered inside my RootViewController class. It doesn’t seem to work though as I can’t scroll between the two UIViewControllers I have added (score and settings). All what is displayed on the screen is the second controller added – the SettingsViewController.

Q2) Why is this broken?

Thank you. 🙂

  • 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-05-26T17:44:17+00:00Added an answer on May 26, 2026 at 5:44 pm

    Actually you place the first controller correctly, then you put the second above it.

    settingsController.view.frame = CGRectMake(0.0f, 0.0f, 960f, 640f);
    
    1. 960×640 – this is not the correct way to enter coordinates (320×480 is the actual size) double size is used only for image files
    2. 0.0f, 0.0f means x: 0, y: 0, so in the second controller you need x: 320, y: 0

    then, you have to set the contentSize of the scrollView

    scrollview.contentSize = CGSizeMake(320*2, 480);
    

    Then enable the paging of the scrollView;

    scrollview.pagingEnabled = YES;
    

    And that should work 🙂

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

Sidebar

Related Questions

I have two UIViewControllers that are contained in a navigatoin view controller and both
I have this iPad application with different NIBs and views. Each view has two
I have two UITableView, each one has a different delegate in the same UIViewController.
I have two NIB's ParentViewController.xib ChildViewController.xib ParentViewController.xib contains a UIView and a UIViewController. ChildViewController.xib
Have two folders with approx. 150 java property files. In a shell script, how
I have two application that need to talk to each other. App1 needs to
I have this same piece of code in two different parts of my app.
I have two UIViewControllers which I sometimes need to show at the same time.
I have a simple storyboard consisting of two UIViewControllers, with a segue connecting them.
I have a main UIViewcontroller (vcMain) with two UIViewControllers subclassed from the main one.

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.