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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:06:04+00:00 2026-05-16T21:06:04+00:00

When programming my app, I get to the point where I have to update

  • 0

When programming my app, I get to the point where I have to update two rectangles on the screen. So I call [self setNeedsDisplayInRect:rect1] and then [self setNeedsDisplayInRect:rect2]. When my drawRect method is called, the rectangle parameter is the smallest rectangle which contains both rect1 and rect2.

I can handle this with no problem, but when the two rectangles are far apart, then I am updating a lot of real estate with no gain. In this case, I would just like to repaint my two small rectangles.

So my question is how can I prevent the underlying system from coalescing my two calls into one?

  • 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-16T21:06:04+00:00Added an answer on May 16, 2026 at 9:06 pm

    You don’t have to prevent the system from coalescing the calls because in -drawRect:, you can query the individual regions that have to be updated by calling -getRectsBeingDrawn:count:. This will return your individual rectangles rect1 and rect2.

    Note that -getRectsBeingDrawn:count: is guaranteed to return non-overlapping rectangles. This seems to imply that if, for example, you called -setNeedsDisplayInRect: twice for the same rectangle, -getRectsBeingDrawn:count: would only return that rectangle once. In other words, you don’t need to worry that you’re drawing the same region twice.

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

Sidebar

Related Questions

I'm programming an Android app, where I have to store pictures to some online
I'm abit new to programming Android App's, however I have come across a problem,
I'm working on a very simple iOS app to get me started programming. It's
The android-app I'm programming is going to have a database of products, say 150-250
I'm working on an iPhone app (first real programming project) and I had two
I have an app with dynamic data and the update method uses arrayWithContentsofURL and
I'm programming an app for the iPhone. I'm not very good with loops just
I am programming a Java app in which i need to constantly check that
I'm programming an iPhone app and I'm wondering how programmers properly position controls without
I'm programming my very first GUI app in Java using the Swing framework. I've

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.