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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:03:59+00:00 2026-06-14T14:03:59+00:00

I have an application which has a fullscreen UIScrollView, and within it there are

  • 0

I have an application which has a fullscreen UIScrollView, and within it there are seven images. The images are also meant to be full screen, and the scroll view is set to enable pagination.

I have a method which either creates or moves the image views:

-(void)rebuildImageView{

    // set up images
    float screenW = self.view.bounds.size.width;
    float screenH = self.view.bounds.size.height;
    int numImgs = self.soundNames.count;

    self.mainScrollView.contentSize = CGSizeMake(screenW * numImgs, screenH);
    for(int i=0; i<numImgs; i++){

        UIImageView* imageView = (UIImageView*)[self.mainScrollView viewWithTag:i+100];
        if(imageView == nil){
            imageView = [[UIImageView alloc] init];
            imageView.tag = i+100;
            [self.mainScrollView addSubview:imageView];
            imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"image%d.jpg",i]];
            imageView.contentMode = UIViewContentModeScaleAspectFill;
            imageView.clipsToBounds = YES;
            [imageView release];
        }
        imageView.frame = CGRectMake(i * screenW, 0, screenW, screenH);
    }

    // scroll to the current one
    [self.mainScrollView scrollRectToVisible:CGRectMake(self.currentSound*screenW, 0, screenW, screenH) animated:YES];
}

I also have this on the view controller:

-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
    [UIView animateWithDuration:duration animations:^{
        [self rebuildImageView];
    }];
}

This code works fine when I autorotate while image 0 is being shown, but when I’m on image 7, you can briefly see most of image 6 when rotating. This video shows what’s happening:

http://www.youtube.com/watch?v=1O3jOcTgVP8

Is there a better method I should use to reconfigure the scroll view and images when rotating the device?

  • 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-14T14:04:00+00:00Added an answer on June 14, 2026 at 2:04 pm

    Any frame changes put in the willAnimateRotationToInterfaceOrientation:duration method should automatically animate. So you could try removing it from the block?

    Personally, I’ve had a lot more luck with this type of thing subclassing UIScrollView and putting the equivalent layout subview frame code in an override of the layoutSubviews method (don’t forget to call super or you might end up with misplaced scroll bars).

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

Sidebar

Related Questions

I have a full screen (100%, even covers taskbars) application which sometimes asks for
I have an application which has the following characteristics There are Clubs Each Club
I have an application which has a similar interface to Visual Studio, in that
I have an application which has a Projects table and a Users table. In
We have an application which has about 15000 pages. For better SEO reasons we
I have an Erlang application which has a dependency in its deps directory on
I have an MVC application which has a set of fields for contact details
I have an iphone application which has about 4 tabs. How do I force
I have a Windows application which has a browser in it. The Windows application
I have a Java Application which has to load an DLL with a few

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.