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

  • Home
  • SEARCH
  • 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 543515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:33:34+00:00 2026-05-13T10:33:34+00:00

I want to initialize 5 viewController’s that I want to be able to flick

  • 0

I want to initialize 5 viewController’s that I want to be able to flick between in a UIScrollView, when my app loads.

  • 1 1 Answer
  • 1 View
  • 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-13T10:33:34+00:00Added an answer on May 13, 2026 at 10:33 am

    Here is an example of how you can do this:

    - (void)viewDidLoad 
    {
    
        //standard UIScrollView is added
        UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
        [self.view addSubview:scrollView];
    
        scrollView.pagingEnabled = YES;
        scrollView.contentSize = CGSizeMake(320*2, 460); //this must be the appropriate size!
    
        //required to keep your view controllers around
        controllers = [[NSMutableArray alloc] initWithCapacity:0];
    
        //just adding two controllers
        LabeledViewController *one = [[LabeledViewController alloc] initWithPosition:0 text:@"one"];
    
        [scrollView addSubview:one.view];
        [controllers addObject:one];
    
        LabeledViewController *two = [[LabeledViewController alloc] initWithPosition:1 text:@"two"];
        [scrollView addSubview:two.view];
        [controllers addObject:two];
    }
    

    LabeledViewController is pretty simple, but you can add as much to it as you want:

    @implementation LabeledViewController
    
    - (id)initWithPosition:(NSInteger)position text:(NSString*)text 
    {
        if (self = [super init]) {
            myPosition = position;
            myText = [text retain];
        }
        return self;
    }
    
    
    - (void)viewDidLoad 
    {
        //this will setup the position in the UIScrollView
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(320*myPosition, 0, 320, 460)];
        self.view = view;
    
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 320, 50)];
        label.text = myText;
    
        [self.view addSubview:label];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to initialize an array and then initialize a pointer to that array.
I want to be able to initialize a CArticle having the following properties: Private
I'm a iPhone App newbie. I have a viewcontroller and want to load a
I have a view controller that I want to lazily initialize, and once initialized,
I want to initialize an array that has X two-dimensional elements. For example, if
I want to initialize a String in Java, but that string needs to include
I want to initialize a struct element, split in declaration and initialization. This is
I want to initialize a static collection within my C# class - something like
I want to initialize all elements of: char buffer[1000][1000]; to ' ' . I've
I want to initialize a protected member in a derived class using the constructor,

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.