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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:30:14+00:00 2026-05-24T19:30:14+00:00

I have a ScrollView and it will be filled with lots of views. My

  • 0

I have a ScrollView and it will be filled with lots of views.

My views have a background and will receive a dynamic amount of buttons.

I need to add these views on my ScrollView.

Each view will be placed below the previous. My views have 1024 x 197

Hoe do I do that?

Thanks in advance for any help.

MORE DETAILS

I have created the view (the one I need repeated) on Interface Builder

@interface PortalBookViewController : UIViewController {
    UIView *prateleira;
    UIScrollView *ScrollView;
}

@property (nonatomic, retain) IBOutlet UIScrollView *ScrollView;
@property (nonatomic, retain) IBOutlet UIView *prateleira;

@end

I have linked that View(Interface Builder) with *prateleira

- (void)viewDidLoad {
    [super viewDidLoad];


    for (int i = 0; i < 4; i++) {
        switch (i) {
            case 0:
                prateleira = [prateleira initWithFrame:CGRectMake(0, 0, 1024, 197)];
                [ScrollView addSubview:prateleira];
                [prateleira release];
                break;
            case 1:
                prateleira = [prateleira initWithFrame:CGRectMake(0, 198, 1024, 197)];
                [ScrollView addSubview:prateleira];
                [prateleira release];
                break;
            case 2:
                prateleira = [prateleira initWithFrame:CGRectMake(0, 384, 1024, 197)];
                [ScrollView addSubview:prateleira];
                [prateleira release];
                break;
                break;
            case 3:
                prateleira = [prateleira initWithFrame:CGRectMake(0, 582, 1024, 197)];
                [ScrollView addSubview:prateleira];
                [prateleira release];
                break;
                break;
            default:
                break;
        }
    }

    [ScrollView release];


}

MODE DETAILS

If I do that: [self.ScrollView addSubview:prateleira]; it will show me this:

enter image description here

I think the problem is on setting the view position.

  • 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-24T19:30:15+00:00Added an answer on May 24, 2026 at 7:30 pm

    the solution was to create a uiview object like:

    UIView * shelf_view (NSInteger x, NSInteger y) {
    
        UIView *shelf = [[UIView alloc] initWithFrame:CGRectMake(x, y, 1024, 197)];
        UIImageView *background = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"shelf.png"]];
        [shelf addSubview:background];
        return shelf;
    
    }
    
    // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    - (void)viewDidLoad {
    
        for (int i = 0; i < 4; i++) {
            switch (i) {
                case 0:
                    [ScrollView addSubview: shelf_view(0, 0)];
                    break;
                case 1:
                    [ScrollView addSubview: shelf_view(0, 197)];
                    break;
                case 2:
                    [ScrollView addSubview: shelf_view(0, 512)];
                    break;
                case 3:
                    [ScrollView addSubview: shelf_view(0, 777)];
                    break;
                default:
                    break;
            }
        }
        [super viewDidLoad];
        [ScrollView release];
    
    
    }
    

    It works perfectly.

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

Sidebar

Related Questions

I am trying to create a scrollview which will have many views (uiimageviews, uitextfield,
I have a custom Scrollview, HorizontalScrollview, and inside is a dynamic table. Each row
I have a relativelayout within a scrollview with 12 buttons. On each button clicked
I have a scrollview in which i am creating buttons programmatically. On touch, button
I have a scrollView (width:320px height:100px) on my UIView, inside it I add 10
I need to have a fixed row with a scrolling area below it filled
I have 2 scrollviews, super scrollview includes multiple scrollviews inside. Super scrollview will make
I have an Android program with a ScrollView that will correctly do an automatic
i have a UIScrollView, when somebody click a button, the scrollview will become longer.
I have 1 scrollview that contain 18 buttons. 1) when a user taps on

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.