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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:52:56+00:00 2026-05-29T05:52:56+00:00

I am creating a musical instrument for the iPhone. In my app when i

  • 0

I am creating a musical instrument for the iPhone. In my app when i touch a CALayer a note plays and the layer does a wiggle for the duration of the note.

This was all working perfectly on iOS 4.1, however I just upgraded to iOS 5.0.1 and experienced major lag issues if I pressed multiple notes in succession. After much pain I have narrowed it down to the following wiggle animation code for the CALayer that is touched.

// here is an example wiggle
CABasicAnimation *wiggle = [CABasicAnimation animationWithKeyPath:@"transform"];
wiggle.duration = 0.1;
//wiggle.repeatCount = 1e100f;
wiggle.repeatCount = 100;
wiggle.autoreverses = YES;
wiggle.toValue = [NSValue valueWithCATransform3D:CATransform3DRotate(fret.fretLayer.transform,0.2, 0.0 ,1.0 ,2.0)]; //angle, x , y , z
wiggle.fromValue = [NSValue valueWithCATransform3D:CATransform3DRotate(fret.fretLayer.transform,-0.2, 0.0 ,1.0 ,2.0)]; //angle, x , y , z

// doing the wiggle
[note.noteLayer addAnimation:wiggle forKey:@"wiggle"];

If I block out the last line where the animation is added to the layer all lag disappears immediately. It feels like the main thread is being blocked somehow, or its not running on the main thread, but I have tried invoking the function with performSelectorOnMainThread:withObject:waitUntilDone:NO and it made no difference. If I press loads of notes really quickly the whole app pauses, and then a second or so later its like it catches up with itself and suddenly all the sound plays and the animation finally begins all choppy and choked after that.

Does anyone know of any unusual issues with CABasicAnimation in iOS 5? Is there any alternative animation APIs that I could try that could also animate CALayers for an unspecified duration on repeat? Anyone have any suggestions or guesses as to how to fix/what the problem could stem from?

EDIT:
I have determined it is definitely nothing to do with nature of the animation. I replaced the wiggle code with code that simply fades the colour like so, but I am still getting the same lag effect with notes being laggy to play.

CABasicAnimation *wiggle = [CABasicAnimation animationWithKeyPath:@"backgroundColor"];
wiggle.duration = 2;
wiggle.toValue = (id)[UIColor whiteColor].CGColor ;
wiggle.fromValue = (id)[UIColor colorWithRed:0.1 green:0.2 blue:0.8 alpha:0.4].CGColor;

Suspect it could be something to do with a change in CoreAudio/RemoteIO perhaps? And that is interfering with the main thread or visa versa?

  • 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-29T05:52:57+00:00Added an answer on May 29, 2026 at 5:52 am

    Finally worked out the true nature of what was causing the issue. Turns out there is a problem with using shouldRasterize = YES in iOS 5.

    In my app I am embedding 100+ CALayers in a UIView which has had its layer set to shouldRasterize = YES. I created a new app from the ground up and added bits in until i replicated the problem. Ultimately it turned out to be this. In iOS 4 this isnt a problem. In iOS 5 it is. If I turn shouldRasterize off the problem disappears immediately.

    Have submitted a bug report with apple.

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

Sidebar

Related Questions

Creating an a app, where I store bunch of photos in the drawable folder,
(creating a separate question after comments on this: Javascript redeclared global variable overrides old
Creating a Blackberry app. Just a beginner, I have searched but couldn't find a
Creating extensions got much easier with Vs2010, but this seems not to be the
Creating a searchable contacts kind of app. Below is my code public class EmployeeList
Creating a mini-database with access, i came across this problem: For the background, i
Creating an Iphone application, I used to perform INSERT QUERY on different databases. But
Creating this ajax styled wordpress portfolio theme and I'm a little stuck on how
Creating My Windows Form Application and using ADO.Net as Data Access layer and SQL
Creating Traversals for Binary Search Tree with Recursion. void inOrder(void (*inOrderPtr)(T&)) { if(this->left !=

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.