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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:55:34+00:00 2026-05-24T03:55:34+00:00

Most of the sample code on the net assumes your UIScrollView will be full-screen.

  • 0

Most of the sample code on the net assumes your UIScrollView will be full-screen.

I’m trying to create a UIScrollView with just a UIImageView inside it, and just want to be able to pinch zoom as would normally happen. My UIScrollView only fills a part of the screen, so I can’t just use autosizing to keep it the right size, as the sample applications seem to do.

The closest I’ve got is to add this to the UIScrollViewDelegate:

- (void)scrollViewDidZoom:(UIScrollView *)scrollView {
CGPoint cOffset = imageScrollView.contentOffset;
float cScale = imageScrollView.contentScaleFactor;

CGRect imageFrame = ptImage.frame;

float scale = scrollView.zoomScale;

imageFrame.size.width *= scale;
imageFrame.size.height *= scale;

ptImage.frame = imageFrame;

scrollView.zoomScale = 1.0;
scrollView.frame = CGRectMake(0.0, 0.0, scrollContainerView.frame.size.width, scrollContainerView.frame.size.height);
scrollView.bounds = CGRectMake(cOffset.x * cScale * scale , cOffset.y * cScale * scale, scrollView.bounds.size.width, scrollView.bounds.size.height);

scrollView.contentSize = imageFrame.size;

}

The only problem here is that the bounds offset (scrollView.bounds = …) is incorrect.

Surely it’s far simpler than I’ve done here?

Any help?

  • 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-24T03:55:34+00:00Added an answer on May 24, 2026 at 3:55 am

    Try returning your UIImageView in :

    - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
    

    And remove the code you put in the didZoom method and see if that works.

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

Sidebar

Related Questions

I have downloaded TableView sample code '4_TableViewCellSubviews' from internet. I am trying to run
While most code samples around the net use a static declaration of DependencyProperties, I
I am trying to learn using DOMDocument for parsing HTML code. I am just
I am working on code for an ASP.NET MVC application that will do the
below i have a code that runs in most of my simple programs ..
I can follow most of Apple's WiTap sample, but am sort of stumped on
I am trying to get comp1's value in the most simple way in C#.
I've been looking at sample code for interfacing with the Windows Task Scheduler, and
I've been trying to follow this tutorial for deploying a WCF sample to IIS
can someone help me pls, im new to vb.net and im trying to work

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.