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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:16:13+00:00 2026-06-08T03:16:13+00:00

I have a UIScrollView with a UIImageView in order to enable zoom features. The

  • 0

I have a UIScrollView with a UIImageView in order to enable zoom features.

The problem now is that the scrollView should be shown fullscreen (except the navigationBar), but it’s shown with a weird “offset”.

Due that images explains more than 1000 words, here it is:

The red rectangles are the weird offset that’s being shown, while the image should take the whole view, but it’s not. As you see,it’s being cut instead.

I tried changing the frame, bounds etc but same result.

Here’s my code:

- (void)viewDidLoad
{   [super viewDidLoad];

    self.view.backgroundColor = [UIColor scrollViewTexturedBackgroundColor];

    imageScrollView.bouncesZoom = YES;
    imageScrollView.delegate = self;
    imageScrollView.clipsToBounds = NO; // If set to yes, the image would be like the screen above
    imageView = [[UIImageView alloc] init];
    imageView.clipsToBounds = YES;


    imageScrollView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin);

    //activity indicator
    UIActivityIndicatorView *activityIndicator = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge] autorelease];
    activityIndicator.hidesWhenStopped = YES;
    activityIndicator.hidden = NO;
    activityIndicator.center = CGPointMake(self.imageView.frame.size.width /2, self.imageView.frame.size.height/2);
    [activityIndicator startAnimating];


    [imageView setImageWithURL:[NSURL URLWithString:tipImageString]
              placeholderImage:nil options:SDWebImageProgressiveDownload
                       success:^(UIImage *image) { [activityIndicator stopAnimating];[activityIndicator removeFromSuperview]; }
                       failure:^(NSError *error) {  [activityIndicator stopAnimating];[activityIndicator removeFromSuperview]; }];
    [imageView addSubview:activityIndicator];

    imageView.userInteractionEnabled = YES;
    imageView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin);
    imageView.center = [[imageScrollView window] center];
    imageView.contentMode = UIViewContentModeScaleAspectFit;
    [imageScrollView setContentMode:UIViewContentModeScaleAspectFit];
    [imageScrollView addSubview:imageView];
    imageScrollView.contentSize = self.imageView.image.size;    
    imageScrollView.decelerationRate = UIScrollViewDecelerationRateFast;

    CGSize boundsSize = self.imageScrollView.bounds.size;
    imageView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
    CGRect frameToCenter = imageView.frame;

    // center horizontally
    if (frameToCenter.size.width < boundsSize.width)
        frameToCenter.origin.x = (boundsSize.width - frameToCenter.size.width) / 2;
    else
        frameToCenter.origin.x = 0;

    // center vertically
    if (frameToCenter.size.height < boundsSize.height)
        frameToCenter.origin.y = (boundsSize.height - frameToCenter.size.height) / 2;
    else
        frameToCenter.origin.y = 0;

    imageView.frame = frameToCenter;

    // calculate minimum scale to perfectly fit image width, and begin at that scale
    float minimumScale = 0.50;//[imageScrollView frame].size.width  / [imageView frame].size.width;
    imageScrollView.maximumZoomScale = 5.0;
    imageScrollView.minimumZoomScale = minimumScale;
    imageScrollView.zoomScale = minimumScale;
    [imageScrollView setContentMode:UIViewContentModeScaleAspectFit];
    [imageView sizeToFit];

    [imageScrollView setContentSize:CGSizeMake(imageView.frame.size.width, imageView.frame.size.height)];

}

I tried everything, but with no success!

I think that’s something with frames but i can’t figure out what.

Any help appreciated

  • 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-08T03:16:16+00:00Added an answer on June 8, 2026 at 3:16 am

    @Pheel Glad that you find it due to CGAffineTransformMakeRotation of the image. This may change the coordinates.

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

Sidebar

Related Questions

I have a UIScrollView loaded with a UIImageView, so that the user can zoom
I have a UIImageView that is housed inside a UIScrollView . The image in
I have UIScrollView in my view. Problem is that if I slightly scroll it
I have a UIScrollView containing a UIImageView. now I also added a two finger
in my app i have UIImageView inside UIScrollview which i can zoom in and
I have a real tall uiimageview in a uiscrollview. The scrollview needs to begin
So i have a UIScrollview with UIImageView set with a button, I want to
I have a UIScrollview with a UIImageview inside it showing a floor plan. I
i have an uiscrollview with a uiimageview inside. I subclass the uiscrollview but i
I have a UIScrollView which has an UIImageView in it. I need to be

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.