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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:27:19+00:00 2026-06-04T13:27:19+00:00

I have a UIImageView element as a subview of my main UIScrollView element. I

  • 0

I have a UIImageView element as a subview of my main UIScrollView element.
I want the Image to fill out the whole screen at all times, but I can drag the edges a bit too far, so that the yellow “background” becomes visible.
If I lift my finger, the Image “bounces” back and fills out the screen correctly.

I want to prevent this dragging of the image off screen.
I do however want the image to bounce back once I drag it out of the “safety area”.

This is my ScrollView initialization:

- (id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:CGRectMake(0, 0, frame.size.height, frame.size.width)];
if (self) {
    [self initImageValues];

    self.showsVerticalScrollIndicator = NO;
    self.showsHorizontalScrollIndicator = NO;
    self.bouncesZoom = YES;
    self.decelerationRate = UIScrollViewDecelerationRateFast;
    self.delegate = self;
    self.backgroundColor = [UIColor yellowColor];
    self.minimumZoomScale = 1.0;
    self.maximumZoomScale = 2.0;
    [self setCanCancelContentTouches:YES];
    self.clipsToBounds = YES;

    // Load Image
    imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]];
    [self addSubview:imageView];

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

    // Set bigger "bounce" zone (safety area)
    self.contentInset=UIEdgeInsetsMake(-SAFETY_ZONE,-SAFETY_ZONE,-SAFETY_ZONE,-SAFETY_ZONE);

    self.scrollEnabled = YES;

}
return self;}
  • 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-04T13:27:20+00:00Added an answer on June 4, 2026 at 1:27 pm

    Use these delegate methods:

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView
    - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
    

    Then read the offset and return if it’s out of the “safety area”.

    Could be that you need another delegate method from the UIScrollView though, but a workaround like this should fix your problem 🙂

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

Sidebar

Related Questions

I have an UIImageView on my view. Certain parts of that image, I want
I have a UIImageView whose image I want to change depending on user input.
I have an UIImageView inside an UIScrollView. I want that the user can zoom
I have a UIImageView which has a png image sequence loaded into it. My
I have a UIImageView showing a image that is larger than it's frame. It's
I have a UIImageView that starts off with an image (loading.png) specified in IB.
I have UIImageView in a custom TableViewCell . I load an image in it
I have a UIImageView that I've added a PinchGestureRecognizer to. Currently, the image is
I have one UIImageView with a UIButton partially overlapping it. I want the user
I have a UIImageView with an image in it. I have rotated the image

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.