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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:44:04+00:00 2026-05-12T09:44:04+00:00

How do I use Core Graphics to draw inside of a instantiated UIImageView (No

  • 0

How do I use Core Graphics to draw inside of a instantiated UIImageView (No class files to override drawrect with — just a reference to the instance)? I want to draw a simple point of fixed width (say, 10 pixels diameter) and of a certain color.

  • 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-12T09:44:05+00:00Added an answer on May 12, 2026 at 9:44 am

    How do I use Core Graphics to … draw a simple point of fixed width (say, 10 pixels diameter) and of a certain color[?]

    1. Set the fill color.
    2. Move to the point.
    3. Plot an arc, centered at the point, with the desired radius, giving a start angle of 0 and an end angle of 2 * M_PI.
    4. Close the path.
    5. Fill.

    … draw inside of a instantiated UIImageView (No class files to override drawrect with — just a reference to the instance)

    I know that on the Mac, that’s really not a good idea, as an NSView may redraw at any time if anything has set it as needing display (or told it directly to display), and would then clobber anything you’d drawn over it. No idea about the iPhone, but I do notice that UIView doesn’t have methods like NSView’s lockFocus and unlockFocus.

    There’s a more architectural reason not to do this: Drawing is the exclusive domain of views, and you’re proposing to break that exclusivity and sprinkle some drawing code in (I’m assuming) a controller. Scattering code for a purpose in an object that doesn’t have that purpose is a path to messy, unnavigable code.

    Better to make a subview for each point and add those as subviews of the image view, or subclass UIImageView, give your instance of that subclass an array of the points to draw, and have the subclass’s drawRect: call up to super before drawing its points.

    The above solution, then, goes in drawRect:.

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

Sidebar

Related Questions

I use pstack to analyze core dump files in Solaris How else can I
I tried to use this on my class library mylib.core.data.dll and got a successful
I try to draw rain and snow as particle system using Core Graphics .
If I'm looking to use Core Animation to fade a view in and out
We have a 12-year-old Ms Access app that we use for our core inventory
I use rsync to synchronize files to Windows clients in a server agnostic way.
It's really a pain, but always when I draw an UIImage in -drawRect:, it's
'''use Jython''' import shutil print dir(shutil) There is no, shutil.move, how does one move
Use case: A does something on his box and gots stuck. He asks B
Use case: 3rd party application wants to programatically monitor a text file being generated

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.