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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:34:25+00:00 2026-06-09T05:34:25+00:00

I am new to iphone development . Can anyone please tell me how to

  • 0

I am new to iphone development . Can anyone please tell me how to add a vertical scrollview inside a horizontal scroll view. I went through many samples but couldn’t get a clear picture about it . I wan my view to be scrolled in both vertical and horizontal directions. Any help is appreciated.

Here is my code for scrolling:

EDIT: Here is my code for scrolling

  self.firstScroll.pagingEnabled=YES;

 self.firstScroll.clipsToBounds=YES;

   int numberOfViews=3;

 for(int i=0;i<numberOfViews;i++){

    CGFloat xOrigin=self.view.frame.size.width*i;

    UIView *awesomeView=[[UIView alloc] initWithFrame:CGRectMake(xOrigin, 0,        self.view.frame.size.width, self.view.frame.size.height)];
    awesomeView.backgroundColor=[UIColor colorWithRed:0.5/i green:0.5 blue:0.5 alpha:1];
    [self.firstScroll addSubview:awesomeView];
 }
self.firstScroll.contentSize=CGSizeMake(self.view.frame.size.width*numberOfViews,     self.view.frame.size.height);
[self.view addSubview:firstScroll];


self.nextVerticalScroll.pagingEnabled=YES;
for(int i=0;i<numberOfViews ;i++){
    CGFloat yOrigin=self.view.frame.size.height * i;
    UIView *verticalView=[[UIView alloc]initWithFrame:CGRectMake(0, yOrigin, self.view.frame.size.width, self.view.frame.size.height)];
  verticalView.backgroundColor=[UIColor colorWithRed:0.5/i green:0.5 blue:0.5 alpha:1];
    [self.nextVerticalScroll addSubview:verticalView];
}
self.nextVerticalScroll.contentSize=CGSizeMake(self.view.frame.size.width, self.view.frame.size.height*numberOfViews);
[self.view addSubview:nextVerticalScroll];

Thanks,

Raj

  • 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-09T05:34:26+00:00Added an answer on June 9, 2026 at 5:34 am

    You probably do not want to have scrollviews within scrollviews because you can’t control which gets the horizontal gestures and which gets the vertical gestures (without a lot of hassle, at least). It is much easier to have a single scrollview with a contentSize that is bigger horizontally and vertically than the bounds of the scrollview itself, e.g.:

    - (void)configureScrollView
    {
        NSInteger rows = 4;
        NSInteger cols = 5;
    
        CGFloat width = self.scrollView.bounds.size.width;
        CGFloat height = self.scrollView.bounds.size.height;
    
        // configure my scroll view itself
    
        self.scrollView.contentSize = CGSizeMake(width * cols, height * rows);
        self.scrollView.pagingEnabled = YES;
        self.scrollView.backgroundColor = [UIColor darkGrayColor];
    
        // now let's add the labels to the scrollview
    
        for (NSInteger row = 0; row < rows; row++)
        {
            for (NSInteger col = 0; col < cols; col++)
            {
                // making my label just a little smaller than the scrollview's bounds so I can easily see the scrolling/paging
    
                CGRect frame = CGRectMake((width * col) + 20.0, (height * row) + 20.0, width - 40.0, height - 40.0); 
    
                // create and configure the label
    
                UILabel *label = [[UILabel alloc] initWithFrame:frame];
                label.text = [NSString stringWithFormat:@"%1.0f", row * cols + col + 1.0];
                label.textAlignment = UITextAlignmentCenter;
                label.backgroundColor = [UIColor lightGrayColor];
    
                // add it to my scrollview
    
                [self.scrollView addSubview:label];
            }
        }
    }
    

    I’m just filling my scroll view with 20 different text labels (and colored the background of the scrollview differently from the labels so I could see them), but it demonstrates the basic idea.

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

Sidebar

Related Questions

I am new to iphone development. Can anyone tell me how to implement a
Im new to iPhone game development, can you please explain about the GLKMatrix4 in
I'm new to iPhone development. I'm working on a table view (default UITableView subclass)
I'm new to iPhone development and have a question I hope someone can help
i m new to iphone/ipad application development, can we import 3d image in my
Hi im new to iphone development by searching i found that iphone development can
Hi i am new to iphone development,can any one help how to append string
i am new in iphone development, i am using table view to list name
Im new to iphone development. here i want to view the screen like landscape
Im new to iPhone development and I have really taken this to me. I

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.