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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:39:41+00:00 2026-05-25T23:39:41+00:00

I am calling setNeedsDisplay from touches moved (and have also tried not calling from

  • 0

I am calling setNeedsDisplay from touches moved (and have also tried not calling from touches moved, but instead from a 0.05 timer) and the drawrect method is always laggy. Is their anyway to change this? I am doing a lot of drawing in drawrect but I have no idea for a solution to fix the lag. Even when the timer was called at a 1.0 interval than it still lagged when the timer called the selector. Also, I have no leaks (I checked using Xcode analyze feature ). Please help!!

EDIT: I am calling setNeedsDisplay, not drawRect from my timer/method

EDIT: It seems that wherever core graphics does somethings with a lot of drawing it always lags. I am positive I have no memory leaks and I even created another painting app and it lags (what is the fix to this?? Please help mee)

  • 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-25T23:39:42+00:00Added an answer on May 25, 2026 at 11:39 pm

    Slightly edited transcript of comments on one of the other answers:

    I am drawing a color a hue based color picker (in draw rect a line for each hue value is drawn)

    … Are you drawing 360 rectangles?

    Yes, I am ….

    I draw the images of 360 rectangles of different colors into the image of one UIImageView. than I release the rectangles. (I use a for loop for the rectangle allocation/releasing)

    So, you are doing this 360 times:

    1. Create an image.
    2. Draw a rectangle into this image. (Or not, if step 1 loads the image from a file.)
    3. Draw that image into another image.
    4. Release the image.

    And then you pass the image that you drew all the smaller images into to a UIImageView for the actual display?

    It sounds like you’re trying to cache this in the image, which should help after the first time if you do it right, but this doesn’t need to be slow in the first place.

    You already have a custom view. Drop the image view, and cut out all this rectangle-drawing (or image-drawing) code. If you have image files with the individual colored rectangles, delete them.

    In your view’s drawRect:, create a gradient and draw that. Your drawRect: will be three lines long and should be much, much, much faster.

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

Sidebar

Related Questions

Calling the ajax called URL works well without ajax eg. http://localhost/ci/controller/method/param_value . But using
I have ClockViewController.h and ClockViewController.m inherited from UIViewController. Also 2 other files ClockView.h and
i have this code in my overridden drawRect method NSDate *date = [NSDate date];
Calling a Lua function from C is fairly straight forward but is there a
I have the often discussed drawRect not getting called. I've been through many posts,
Calling image = Image.open(data) image.thumbnail((36,36), Image.NEAREST) will maintain the aspect ratio. But I need
Calling Html.RenderPartial(~/Views/Payments/MyControl.ascx); from a view works if MyControl.ascx is a control that directly inherits
When calling php via cli, the current directory is NOT changed to the one
I have a TTLauncherView with some TTLauncherItems . These show badges, representing messages from
I have a view that receives new data from a secondary thread. Every time

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.