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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:30:43+00:00 2026-05-20T15:30:43+00:00

I have a UIImageView in a UIScrollView in another UIScrollView (based on Apple’s PhotoScroller

  • 0

I have a UIImageView in a UIScrollView in another UIScrollView (based on Apple’s
PhotoScroller sample code). When the UIScrollView calls back to its controller to dismiss itself, it calls this method:

- (void)dismiss {
    [scrollView removeFromSuperview];
    ImageScrollView *isv = [self currentImageScrollView];
    UIImage *image = isv.imageView;
    image.frame = [self.view convertRect:image.frame fromView:isv];

    [self.view insertSubview:image belowSubview:captionView];
    [(NSObject *)delegate performSelector:@selector(scrollViewDidClose:)
                               withObject:self
                               afterDelay:2.0];
}

Now here’s the weird part: the image view jumps to a different position right after this method executes, but before the scollViewDidClose method gets called on the delegate. If the image is larger than its new super view, it jumps so that its left edge is aligned with the left edge of its super view. If it’s smaller than its new super view, it jumps to the very center of the view. There is no animation to this change.

So my question is, how do I prevent it from doing that? I’ve tweaked both the super view (self.view) class and the image view class to see what methods might be called. Neither the frame nor the center is set on the image view after this method is called, and while the layoutSubviews method is called on the super view, that is not what jumps the image to the center or left side of the superview. I’ve also tried turning off autoResizesSubviews in the super view, and setting the autoresizingMask of the image view to UIViewAutoresizingNone, with no change in behavior.

So where is this happening, and why? And more importantly, how do I make it stop?

I’ve been beating my head on this for days. Any pointers or guidance would be greatly 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-05-20T15:30:44+00:00Added an answer on May 20, 2026 at 3:30 pm

    ImageScrollView is the one centering your UIImageView. Set a breakpoint in ImageScrollView layoutSubviews and you’ll see how your UIImageView is being centered.

    You’re taking ImageScrollView‘s internal imageView and placing it into another view. That’s not going to work because ImageScrollView still retains ownership of that UIImageView instance and is still managing its layout.

    You’ll either need to copy the image into another UIImageView instance, or you’ll need to change ImageScrollView to allow it to relinquish ownership of its imageView.

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

Sidebar

Related Questions

In a UIScrollView I have a UIImageView with the contentMode set to Aspect Fill.
I have a UIImageView inside of a UIScrollView. The parent scroll view allows zooming
Hello i have a uiscrollview and i have one object of uiimageview inside the
Have you guys had any experiences (positive or negative) by placing your source code/solution
I have a UIScrollView that I am using to simulate a UITableView like interaction
i have an uiscrollview and i add one by one uiimageviews but when i
I am trying to add the UIButton to UIScrollView . I have added the
I have two UIImageView objects inside my view (both 320x480 one above the other).
Good day all; I have an UIImageView that I animate around a large UIView.
My application consists of a UIImageView inside a UIScrollView , and I display a

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.