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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:51:56+00:00 2026-05-17T16:51:56+00:00

I have a Quartz 2D game which draws directly onto a context. For this

  • 0

I have a Quartz 2D game which draws directly onto a context. For this reason I am having to adapt the code so that it scales if appropriate for a Retina display. I am doing this using the following code:

- (CGFloat) displayScale
{
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {

    return [[UIScreen mainScreen]scale];

}

else  

{
    return 1.0;
}

}

What I am now struggling with is how to manipulate my Quartz context in my -drawRect: method to mulitply by the returned scale value. Can anyone help me with this code ?

  • 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-17T16:51:56+00:00Added an answer on May 17, 2026 at 4:51 pm

    You don’t need to change anything in your Quartz code to account for the Retina display. If the correct contentScaleFactor is set on your UIView or CALayer using code like the following:

    if ([view respondsToSelector:@selector(setContentScaleFactor:)])
    {
        view.contentScaleFactor = [[UIScreen mainScreen] scale];
    }
    

    the 2-D drawing you do within -drawRect: or -drawInContext: will be automatically rendered sharply for the Retina display. Remember that the coordinates you specify for the Quartz drawing will be in points, not pixels. With a scale factor of 2.0 for a Retina display, 1 point = 2 pixels.

    See the “Updating Your Custom Drawing Code” section in the iOS Application Programming Guide for more.

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

Sidebar

Related Questions

I don't want to transform the ENTIRE context. I'm making a game with Quartz,
I want to develop a 2d game. I have to choose from Quartz/CoreGraphics, OpenGL
I have a Quartz job that has already been scheduled. I want to update
In my Quartz.NET based application, I have a JobListener that audits all jobs executed
I have witten an iPhone game using Quartz 2d. It works fine all devices
I have a Quartz context declared in the main loop as UIGraphicsBeginImageContext(mySize); ctx =
I have a quartz cron trigger that looks like so: <bean id=batchProcessCronTrigger class=org.springframework.scheduling.quartz.CronTriggerBean> <property
I have a quartz scheduler job which scans a directory every 10 seconds and
I have the following problem. I have a quartz job that runs every 5
I have a void method which is part of a flow run by quartz

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.