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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:53:15+00:00 2026-05-26T15:53:15+00:00

I have a UIScrollView with an UIImageView as the content. It displays fine, and

  • 0

I have a UIScrollView with an UIImageView as the content. It displays fine, and scrolls fine. No problems there. The image is considerably wider than the screen, so I want to be able to “auto center” a specific portion (coordinates) of the image within the scrollview.

Here is where I’m stuck, though. The desired centering location will dynamically change based on the use of the application, so I need to be able to configure it so that a desired coordinate of the image view (x,y) is centered automatically within the scrollview when loaded. It doesn’t have to autoscroll/animate, it just needs to be there.

I’ve seen similar questions/answers for centering content when gestures/zooming are being used, but neither are employed here. Just scrolling. I just need to be able to have a set portion of the image be centered within the scrollview when it first loads.

I hope I’ve made sense. Thanks for your time.

  • 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-26T15:53:15+00:00Added an answer on May 26, 2026 at 3:53 pm

    I’m on an iPhone right now, so excuse me if this code is a little funky, as I can’t remember exactly if the center property is available without calling size.center first…

    CGPoint centerOffset = CGPointMake(0, [scrollView contentSize].(size).center);
    [scrollView setContentOffset: centerOffset animated: YES]; // (or No, depends on you)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIScrollView and inside it there is a UIImageView with an image.
I have a UIScrollView whose content size is 1200x480. I have some image views
I have paging UIScrollView with images. I want to implement animated zooming of image
I have an UIImageView with an image (map) inside of a UIScrollView. I add
I have a UIScrollView where the content size is larger than the frame. I
I Have a UIScrollview with a UIImageView inside where I scroll from an image
I have an image inside an UIImageView which is within a UIScrollView. What I
I want to have an UIImageView in an UIScrollView . But I it doesn't
i have an uiscrollview with a uiimageview inside. I subclass the uiscrollview but i
I have a UIScrollView that contains an image and a segmented control that allows

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.