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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:42:11+00:00 2026-05-29T07:42:11+00:00

I am trying to draw an image into a UIView subclass overriding drawRect. This

  • 0

I am trying to draw an image into a UIView subclass overriding drawRect. This image drawing class needs moving and zooming capabilities, so I made it a subview of a scrollview.

My problem is that my image seems to get cropped, either by the screen or the scrollView bounds (the image is larger than the screen). I don’t have a clue why, this seems to e pretty basic stuff.

The view hierarchy in my ViewController looks like this:

View Controller
  View
    ScrollView
      MapView

I’ve created outlets for the scroll view and the map view (which is the view implementing drawRect).

My ViewController initial setup code for configuring the scroll view looks like this:

- (void)viewDidLoad
{
    [super viewDidLoad];
    scrollView.delegate = self; 
    scrollView.contentSize = CGSizeMake(450, 476);
    scrollView.minimumZoomScale = 0.6;
    scrollView.maximumZoomScale = 6.0;
}

My drawRect implementation:

- (void)drawRect:(CGRect)rect
{ 
    UIImage *myImage = [UIImage imageNamed:@"map.jpg"];
    CGRect rectangle = CGRectMake(0,0,450,476);
    [myImage drawInRect:rectangle];
}

The image is draggable and zoomable within the scroll view, but it’s cropped at what seems to be the screen bounds.

Any help would be 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-29T07:42:13+00:00Added an answer on May 29, 2026 at 7:42 am

    drawRect can’t draw outside the rect passed as a parameter to the drawRect method, which is determined by the view frame. Make your view 1200,1200 and make sure that clipToBounds is disabled on all the containing views.

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

Sidebar

Related Questions

I'm trying to draw an image into a LinearLayout, or TableRow, but I'm having
I am trying to draw an image on a drawing area with no luck.I
I am trying to draw circle on an JPEG image which load into my
I'm trying to draw an image in an ImageView, but i want it to
I'm trying to just draw a simple image from the drawable-mdpi folder in android
I'm trying to draw a button with an image as background. Here's my xml:
I'm trying to draw a semi-transparent rectangle on top of an image to act
Working in Visual Studio 2008. I'm trying to draw on a PNG image and
I am trying to use GDI+ to draw text onto an image, however, I
I am running into problems when trying to draw a large 2D array of

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.