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

The Archive Base Latest Questions

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

I use UIBezierPath for finger painting (my app). I create it using path =

  • 0

I use UIBezierPath for finger painting (my app). I create it using path = [UIBezierPath bezier path]; . It constantly lags on the iPad (and calling it from within drawrect did not change anything). I have been working on this for hours on end and have found no solution, just lag. Would somebody be so kind to help me please? Also, I am using a NSTimer to call the function. That is the old way my app will work so please help me fix this lagggg!!!!!

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

    Since none of your questions contains enough details on its own, I’m going to do something improper and post a meta-answer to your current last five questions.

    First, draw in drawRect: and nowhere else.

    That’s so important that I’m going to say it again.

    Draw in drawRect: and nowhere else.

    Not touchesMoved:withEvent:.

    Not touchesBegan: or Ended:.

    drawRect: and nowhere else.

    If you’re making an image to save to a file, that’s one thing. But when you’re drawing to the screen, you don’t do it anywhere other than drawRect:.

    Seriously. It’s that important.

    Step 2: Don’t attempt to force drawing to happen at any other time.

    drawRect: is called for you when it’s time for you to draw. By definition, at any other time, you don’t need to draw, so drawing is doing things you don’t need to do. By extension, don’t call drawRect: yourself. You don’t need to and it never helps.

    Actually, that’s just an extension of step 1. If you call drawRect:, it’s no different from if you had the drawing code where you have the call. The drawing code isn’t repeated everywhere, which is nice, but it’s still running at the wrong time. Let drawRect: only be called when the system calls it.

    setNeedsDisplay exists to tell the system that it’s time to draw. You should do this when, and only when, something has changed that you’ll need to draw. Your view’s properties, something in the model—whenever what you will draw changes, send yourself setNeedsDisplay. Don’t do it at any other time; you don’t need to.

    Cut out the timer. You don’t need it. There’s already a timer in place anyway, limiting you to 60 fps.

    Core Graphics does not lag. No, really, it doesn’t. Slowness or “lag” is because either you’re trying to do too much or you’re doing something wrong.

    Don’t cache unnecessarily. Nothing you’re doing requires an image cache.

    The “lag” is because you’re trying to draw, or to force drawing, from touchesMoved:withEvent: and/or touchesBegan:/Ended:. See above.


    Here’s what you need to do:

    In your touchesBegan:/Moved:/Ended: methods, or other responder methods as appropriate, update your state. This will include the Bézier path. Do not draw, and that includes do not call drawRect: or otherwise attempt to force drawing.

    After you’ve updated your state, and only if you’ve done so, send yourself setNeedsDisplay.

    In your drawRect: method, and only in your drawRect: method, draw the path, gradient, whatever, however you see fit.

    Do these things, and your application will be fast. With Core Graphics. Without lag.


    Also, some important reading:

    • View Programming Guide for iOS
    • Drawing … Programming Guide for iOS
    • Quartz 2D (Core Graphics) Programming Guide
    • Performance Overview (some parts are Mac OS X specific, but much of it is relevant on iOS as well)
    • Instruments User Guide
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to draw custom shapes in iPad application. I am using UIBezierPath
Use case: User launches app The user enters google password The app lets the
I have a pie chart which is made using UIBezierPath's. I now need those
Use Eclipse Classic with ADT plugin. Tried to make project from existing example of
My app will let users cut out things from photos. They'll be able to
I am drawing several UIBezierPath s on a view based on finger movements. Every
use qcvalues_test go select [finalConc] ,[rowid] from qvalues where rowid in (select rowid from
Use AES/Rijndael or any symmetric encryption. Encrypt the hidden value using itself as the
Use http://jobs.sitesixteen.com/ for reference. I'm using YQL for the city, state auto-complete. IF you
Use open syscall to write and create a file ,there's no attributes with the

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.