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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:06:37+00:00 2026-05-17T22:06:37+00:00

I have a scrollview that automatically generates a series of subviews containing imageviews. The

  • 0

I have a scrollview that automatically generates a series of subviews containing imageviews. The concept is that it’s pretty much a custom PDF style reader, where each page is loaded in to an imageview as an image. There are three "layers" – the outer UIScrollView, the automatically generated subViews and the imageview inside the subview.

I’ve been having some trouble with this, I’ve asked the question previously, but unfortunately, the core of my question was in the wrong place. Here is my second attempt:

On rotate, everything is rotated as needed. Unfortunately, this is what I’m getting:
alt text

Obviously, I would like Image 1 to be centred and for there to be no hint of image 2 until you flick the view across.

Here is my code for setting up the view:

- (void)loadView {
    [self setUpView];
}
- (void)setUpView {
    //INITIALISE PAGING SCROLL VIEW
    CGRect pagingScrollViewFrame = [[UIScreen mainScreen] bounds];
    pagingScrollViewFrame.origin.x -= 10;
    pagingScrollViewFrame.size.width += 20;
    pagingScrollView = [[UIScrollView alloc] initWithFrame:pagingScrollViewFrame];
    pagingScrollView.contentMode =  UIViewContentModeScaleAspectFit;
    
    //CONFIGURE PAGING SCROLL VIEW  
    pagingScrollView.pagingEnabled = YES;
    pagingScrollView.backgroundColor = [UIColor blackColor];
    pagingScrollView.contentSize = CGSizeMake(pagingScrollViewFrame.size.width*7, pagingScrollViewFrame.size.height);
    
    //ACTIVATE PAGING SCROLL VIEW
    self.view = pagingScrollView;
    
    //ADD PAGES TO SCROLL VIEW
    for (int i = 0; i < 7; i++){
        ImageScrollView *page = [[[ImageScrollView alloc] init] autorelease];
        [self configurePage:page forIndex:i];
        [pagingScrollView addSubview:page];
    }
}

How do I re-define the size of the frame? What function should I call etc. How do I centre the image?

I’m new to this so I apologise for the ambiguity of my question.

Cheers

  • 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-17T22:06:38+00:00Added an answer on May 17, 2026 at 10:06 pm

    I’ve figured it out. It was the Frame of the individual pages that I needed to change, so (with the help gained from another question) I wrote a re-orient method.

    The first step to this came because I figured out that I needed to iterate through and re-size each frame for each of my pages and then re-apply the frames to the view. For this to happen I needed to create an array which I would fill in the For Loop above. I have 7 total pages.

    Then I could (on rotate) call the below re-orient method to re-size each view:

    - (void) reOrient{
        if(UIInterfaceOrientationIsPortrait(self.interfaceOrientation)){    
            CGRect f;
            int i = 0;
            for (ImageScrollView *page in pageArray) {          
                f = page.frame;
                f.size.width = 320;
                f.origin.x = (f.size.width * i);
                page.frame = f;
                pagingScrollView.contentSize = CGSizeMake(f.size.width * 7, 480);
                i++;
            }
        }else{
            CGRect f;
            int i = 0;
            for (ImageScrollView *page in pageArray) {          
                f = page.frame;
                f.size.width = 480;
                f.origin.x = (f.size.width * i);
                page.frame = f;
                pagingScrollView.contentSize = CGSizeMake(f.size.width * 7,  480);
                i++;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a scrollview control that has a StackPanel (Orientation=Vertical) UI Element inside of
I am working in C# and VS2008. I have a WPF application containing a
I have a scrollView (width:320px height:100px) on my UIView, inside it I add 10
I have a UITextView that has a lot of content. I have a button
I have a problem. I need to host grid with controls in ScrollViewer to
I have a databound and itemtemplated ListBox: <ListBox x:Name=lbLista ScrollViewer.VerticalScrollBarVisibility=Visible> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation=Horizontal>
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you guys had any experiences (positive or negative) by placing your source code/solution
Have just started using Visual Studio Professional's built-in unit testing features, which as 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.