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 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 am trying to draw a background image in my UIView. This is in
I'm trying to draw an image with a certain color. To get this effect,
I'm trying to draw an image in an ImageView, but i want it to
Working in Visual Studio 2008. I'm trying to draw on a PNG image and
I'm currently trying to draw shapes with 2D Arrays. In my class there is
I am running into problems when trying to draw a large 2D array of
I'm trying to convert wmf image file into png format with c#.net. But, saved
I am trying to draw an image from .png resource file. I have tried
I'm trying to render some UIImages into 1 single image that I can save
I've recently taken my first step into GDI+, and am trying to draw an

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.