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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:06:29+00:00 2026-05-20T23:06:29+00:00

I have a CGRect ; can I transfer its coordinates to be in the

  • 0

I have a CGRect; can I transfer its coordinates to be in the user coordinate system, i.e., bottom left corner to top instead of top left corner to bottom. Is there any predefined method for this or do I need to calculate it manually? Thanks in Advance.

  • 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-20T23:06:30+00:00Added an answer on May 20, 2026 at 11:06 pm

    To convert a rectangle from a coordinate system that has its origin at the bottom left (let’s just call it traditional coordinate system to give it name) to a system where the origin is at the top left (iPhone coordinate system) you need to know the size of the view where the CGRect is, since the view is the reference for the rectangle.

    For example, let’s say you have a view with size 200 x 300, and the CGRect you have is CGRectMake(10, 20, 30, 40). The size of the CGRect will remain the same. All that will change is the origin – actually, only the y coordinate will change and not the x coordinate, because the traditional and iPhone coordinate systems both start on the left side (one at the bottom left; the other at the top left).

    So we will have something like CGRectMake(10, y, 30, 40).

      - (CGRect)rectangle:(CGRect)oldRect fromTraditionalToiPhoneCoordinatesWithReferenceViewOfSize:(CGSize)aSize
         {
          CGFloat oldY = oldRect.origin.y;  // This is the old y measured from the bottom left. 
          CGFloat newY = aSize.height - oldY - oldRect.size.height;
    
          CGRect newRect = oldRect;
          newRect.origin.y = newY;
    
          return newRect;
         }
        
    

    The new rectangle, as measured from an iPhone (top left) coordinate system, would be: CGRectMake(10, 300 - 20 - 40, 30, 40) = CGRectMake(10, 240, 30, 40).

    Hopefully this image makes it clearer
    Hopefully this image makes it clearer

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

Sidebar

Related Questions

A UILabel's text is drawn in a CGRect(x,y,size,width). The label can have multiple lines
I am trying to dismiss a view controller from bottom to top instead of
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
I have an image in an UIScrollView, that can be scrolled and zoomed. When
I have a problem with my UIScrollView . It's visible but I can't scroll
I have birds flying within a frame in my game, but I can only
I know that I can't use this: myView.frame.origin.x = 25.0; and that I have
I have an image displayed using CGRect (code below). the problem is that it's
I have in my Picker class: - (id)initWithFrame:(CGRect)frame withSender:(id)sender withDate:(NSDate*)date { if ((self =

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.