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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:10:45+00:00 2026-05-28T08:10:45+00:00

I have a problem understanding how the parameter passed to the drawInRect method is

  • 0

I have a problem understanding how the parameter passed to the drawInRect method is defined when a rotation transformation is performed on a UIView.

To give an example I have a UIView which I rotated with an angle of 307 degree.
In the drawInRect method I log the following:
self.frame: {{103.932, 273.254}, {64.3007, 84.3374}}
rect (the variable passed as parameter:{{0, 0.102913}, {18, 89}}

The problem is that according to the documentation I should not draw outside of rect, but considering what I should draw, there is no way my images will fit there.

Can anyone explain to me how I am supposed to use drawInRect in the case my UIView is rotated ?


To give more detail about my problem, here is what I do:

I have a scrollview with a contentView inside (subclassed). I add my UIViews in the content view.

The views in question are composed of a handler image (bottom left) and the main image (top right). Users are supposed to grab the view by pressing the handler but that’s not the point.

The drawInRect method of the UIView contains the following:

[_image drawInRect:CGRectMake(handlerSize.width, 0, _image.size.width, _image.size.height)];
CGSize size = CGSizeMake(kHandPickerWidth/self.scrollViewScale, kHandPickerHeight/self.scrollViewScale);
[_handPickerImage drawInRect:(0, _image.size.height, size.width, size.height)];

The UIViews objects are added at viewWillAppear in the content view doing the following:

first instanciate,

then addSubview:

then I set the scrollViewScale parameter,

then I set the frame parameter (according to the top right image displayed (which may vary)

then I rotate the UIView.

Starting from line three, the code is executed from the

- (void)scrollViewDidZoom:(UIScrollView *)scrollView

to make sure every variable is set properly when displayed is needed.

The line defining the size variable is to adjust the marker’s size no mater the zoomScale value of the scroll view.

  • 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-28T08:10:46+00:00Added an answer on May 28, 2026 at 8:10 am

    So I found a solution to my problem:

    I was setting the frame parameter multiple times with some CGAffineTransformation defined which is not supposed to be done.

    Now each time I need to reset the frame I reset the affine transform, change the frame and set the back the affine transform.

    Everything works as supposed to this way.

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

Sidebar

Related Questions

I seem to have a problem understanding how to conditionally test a boolean value
I think I have a problem in understanding the proper way of using MVC.
I have an understanding problem of how the following code works: XMLInputFactory xif =
There are many skills a programmer could have (understanding the problem, asking good questions,
I have problem with ActionLink. I'd like to pass to my ActionLink parameter for
I have a modified textbook example as follows (the book is Understanding Ada---a software
i have small problem understanding why my smart pointer class is leaking on self
I have a problem understanding co-existence of null and Option in F#. In a
i have a Problem understanding the @Transactional and @TransactionConfiguration(defaultRollback = true) Annotations. I have
I have a little problem understanding how to to the following in Haskell: Lets

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.