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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:32:24+00:00 2026-05-11T02:32:24+00:00

I’ve got a very simplistic game set up on the iPhone. Things move around,

  • 0

I’ve got a very simplistic ‘game’ set up on the iPhone. Things move around, rotate, you can interact with them, etc. In the simulator, it runs fine, but on the device it gets around 0.25 FPS, and it’s so slow that it doesn’t have time to recognize touches, apparently.

This was originally just using a UIView with an array of Items each of which had a Tick and a Draw function. At the beginning of the app, I started a Timer that shoots off at 60 FPS, which calls Tick, and at the end of Tick, it calls [self setNeedsDisplay];

It was working so horribly slow, so I turned the Item class into a subclass of the CALayer class, moving the layer around instead of redrawing the items. However, I was moving the CALayer around manually, frame-by-frame, and this, apparently, is no good. It was still way too slow. So I told it to move to its final destination and gave it a length equal to the number of ticks it would take to get there.

That worked okay, but there are cases when, if you interact with something, it should stop moving that way and do something else instead. So I moved back to moving every tick, and instead of just setting the new position, I also wrapped it in a CATransaction and gave the transaction the same length as the tick.

Works OK, but new problem arises: If I want to animate something, I still have to use [self setNeedsDisplay] every tick, which calls drawInContext:, and this seems to be a major slow down issue.

Isn’t there just a way to manually draw everything like I was doing before? I was just making CGContext* calls, and it worked fine in the simulator! It would work fine if I implemented something similar on J2ME or in embedded C++. What am I missing? Do I really need to learn OpenGL to do any sort of interesting manual animation?

  • 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. 2026-05-11T02:32:25+00:00Added an answer on May 11, 2026 at 2:32 am

    I found out the real issue was the necessity to call [self setNeedsDisplay]. Redrawing on a frame-by-frame basis is bad mojo. So I am using images instead for the most part, and I can still get away with setting the position on a frame-by-frame basis by setting the actions on the CALayer to null. Specifically:

    NSMutableDictionary *customActions=[NSMutableDictionary dictionaryWithDictionary:[self actions]]; [customActions setObject:[NSNull null] forKey:@'position']; [customActions setObject:[NSNull null] forKey:@'transform']; [customActions setObject:[NSNull null] forKey:@'opacity']; self.actions=customActions; 

    After that call, everything is much faster when calculating frame-by-frame.

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

Sidebar

Ask A Question

Stats

  • Questions 68k
  • Answers 68k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Instead of Attendance = std.Attendances.Count() in your first code sample… May 11, 2026 at 12:21 pm
  • added an answer Memory validator would be ideal for you. http://www.softwareverify.com/cpp/memory/index.html May 11, 2026 at 12:21 pm
  • added an answer An important point that I think people here are missing… May 11, 2026 at 12:21 pm

Related Questions

I keep getting tasks that are above my skill level. How can I address this without coming accross as grossly incompetent?
I have a web-service that I will be deploying to dev, staging and production.
I'm thinking of starting a wiki, probably on a low cost LAMP hosting account.
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.