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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:47:35+00:00 2026-06-04T14:47:35+00:00

I have recently started creating my own controls and I seem to have a

  • 0

I have recently started creating my own controls and I seem to have a bit of trouble understanding how I should use drawRect.

Basically I have 3 Questions.

  1. Is it a good idea to have conditional drawRect’s? ie. different drawing code based on properties or instance variables.

  2. What is the best method for animating changes to the drawRect’s drawing? For example, a fuel gauge control with animated fill and un-fill.

  3. And, finally, the examples I have seen for animating with drawRect tend to use timers, is that really a good method in practice? It seems like the heavier apps would have issues with that method.

I guess a 4th would be, is there, perhaps, a better place to do this kind of stuff?

  • 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-06-04T14:47:36+00:00Added an answer on June 4, 2026 at 2:47 pm

    Is it a good idea to have conditional drawRect’s? ie. different drawing code based on properties or instance variables.

    Sure, why not? If your drawRect: method becomes unwieldy, you could split it into multiple methods that you then call from drawRect: depending on the properties of your view. E.g. you could have methods like drawBackground, drawTitle, etc.

    What is the best method for animating changes to the drawRect’s drawing? For example, a fuel gauge control with animated fill and un-fill.

    That depends. For very small views, you could call setNeedsDisplay from a timer, but for larger views, you’ll often run into performance issues with this approach.

    Animating changes is often better done by compositing your view out of multiple subviews or layers that can be animated with Core Animation (or the simplified UIView animation methods).

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

Sidebar

Related Questions

I have recently started learning wpf and am trying to use mvvm. My understanding
I have been learning MVC recently and have started creating my own framework (for
I have recently started creating an iPhone application using Appcelerator's Titanium. Since the application
I have recently started learning java for creating android apps. I have spent hours
I have recently started to make useful use of C# extension methods. The SO
I have recently started reading up on Grails and would like to use SQL
I have recently started to use Eclipse after using IntelliJ for a few years.
I have recently started to configure Mercurial within my team as a proof of
We have recently started using ImageResizer.Net over GDI+ for dynamically resizing images on our
I have recently started using google places api and am a big noob on

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.