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

  • Home
  • SEARCH
  • 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 7827555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:56:15+00:00 2026-06-02T09:56:15+00:00

That is, if [self setNeedsDisplayInRect:rect]; is called, and rect is very carefully calculated for

  • 0

That is, if

[self setNeedsDisplayInRect:rect];

is called, and rect is very carefully calculated for the region that needs to be redrawn, but if our drawRect code doesn’t care about rect and draw everything anyway, can the iOS system still somehow improve the drawing speed? (or possibly improve very little?) This question probably requires somebody who is very familiar with UIKit/CoreGraphics.

  • 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-02T09:56:23+00:00Added an answer on June 2, 2026 at 9:56 am

    There are a few ways the answer could be yes:

    1. You can clip to the rectangle, in which case anything outside it won’t be painted, even if you draw in it. Drawing outside the rectangle won’t be free, but it will be cheaper. iOS can’t do this for you because you might deliberately ignore the rect, or use the rect but also draw something else elsewhere in your bounds unconditionally. (Though that other thing should probably be another view.)
    2. Even if your current drawRect: doesn’t use the rectangle, you might go back to that code later to optimize it. As you’re probably aware, one very good way to do that—if it’s at all possible—is to use the rectangle to decide what you draw. Even if you’re not doing that now, you may do it in the future, and specifying changed rects now means that many fewer things to change then.
    3. A corollary to #3 is that even if what you’re drawing now can’t be so optimized, you may decide in a future major version to completely change what the view draws to something that can. Again, specifying changed rects now means that many fewer things to do in the future.
    4. Subviews. If your view doesn’t actually draw some of the things that the user sees in it, but rather delegates (not in the Cocoa/Cocoa Touch sense) those things to subviews, then you might override setNeedsDisplayInRect: to send setNeedsDisplay: messages to subviews—and only the subviews whose frames intersect the rect—before calling super. (And UIView’s implementation might already do this. You should test it.)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a class in python that implements __str__(self) but when I use
Rails: I need to set a condition in a has_many that needs the self.id
I have the code below. I'm wondering that does the self.value and _value have
I've got this nifty little piece of code here that self-propogates ad infinitum every
I have a colleague who insists that his code doesn't need comments, it's "self
I read that self-signed certificates suffer from performance issues (for example, here ) but
I read that self closing tags were problematic for some browsers such as IE7
I'm trying to work out a query that self join itself on a table
How do I profile a call that involves self and arguments in python? def
I need to add a rule in the firewall so that my self-hosted http

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.