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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:28:16+00:00 2026-06-09T21:28:16+00:00

I will try to explain my problem as clear as I can. I have

  • 0

I will try to explain my problem as clear as I can.
I have a piano that you can play and record the song what you do, and every button of the piano that you play, this button is highlighted. The problem is that I have another button to play the song that I have recorded, but what I want is to Highlight every button of the piano that is sounding.
Here is a part of the function I’ve coded:

- (IBAction)play:(id)sender
{   
    for(NSString *string in [Singleton sharedInstance].notesMusicals)
        if([string isEqualToString:@"doMenor"]){
            UIImage *buttonImage = [UIImage imageNamed:@"do-menor_ON.png"];
            [doMenorButton setImage:buttonImage forState:UIControlStateNormal];
            CFBundleRef mainBundle = CFBundleGetMainBundle();
            CFURLRef soundFileURLRef;
            soundFileURLRef = CFBundleCopyResourceURL(mainBundle,(CFStringRef) @"Do_m", CFSTR ("mp3"), NULL);
            UInt32 soundID;
            AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
            AudioServicesPlaySystemSound(soundID);
            //doMenorButton.highlighted = YES;
             sleep(1);

        }
        else if([string isEqualToString:@"Re"]){
            UIImage *buttonImage = [UIImage imageNamed:@"do-menor_OFF.png"];
            [doMenorButton setImage:buttonImage forState:UIControlStateNormal];
            UIImage *buttonImage1 = [UIImage imageNamed:@"re_ON.png"];
            [reButton setImage:buttonImage1 forState:UIControlStateNormal];
            CFBundleRef mainBundle = CFBundleGetMainBundle();
            CFURLRef soundFileURLRef;
            soundFileURLRef = CFBundleCopyResourceURL(mainBundle,(CFStringRef) @"Re", CFSTR ("mp3"), NULL);
            UInt32 soundID;
            AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
            AudioServicesPlaySystemSound(soundID);
            sleep(1);

        }

You can see that in every note, I highlight the button of that note, but the problem I have is that the button is only highlighted once the function ends, so all my notes will be highlighted once the melody has finished.
I hope someone can help me.

  • 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-06-09T21:28:17+00:00Added an answer on June 9, 2026 at 9:28 pm

    Try to call your highlightning code in a separate thread with

    [self performSelectorInBackground:@selector(myMethod:) withObject:_myParamsArray];
    

    For example:

    ...
            else if([string isEqualToString:@"Re"]){
                [self performSelectorInBackground:@selector(highlight:) withObject:myButton];
                CFBundleRef mainBundle = CFBundleGetMainBundle();
                CFURLRef soundFileURLRef;
                soundFileURLRef = CFBundleCopyResourceURL(mainBundle,(CFStringRef) @"Re", CFSTR ("mp3"), NULL);
                UInt32 soundID;
                AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
                AudioServicesPlaySystemSound(soundID);
                sleep(1);
    
            }
    
    ...
    
    -(void) highlight:(UIButton)*button
    {
                    UIImage *buttonImage1 = [UIImage imageNamed:@"re_ON.png"];
                    [button setImage:buttonImage1 forState:UIControlStateNormal];
    }
    

    Please excuse if there are any typos in the code. I modified it right here in the editor.

    You’ll need to modify me example in order to deactive other highlighted buttons but that should be no problem

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

Sidebar

Related Questions

I will try to explain the problem that I have with this code. This
i will try to explain the problem. I have this structure: offers -------------- id_offer|offer|company
I have a problem and I will try to explain the issue: I have
I will try to explain this the best way I can, but feel free
I will try to explain my problem clearly: I have two tables: document and
I will try to explain my problem. I have 4 files index.html, event.js, start.js
Good day, i will try to explain my problem as best as i can.
I am having difficulty to explain this problem, but I will try anyway. I
I will try to explain this as well as I possibly can. I'm developing
I have CSS problems. I will try to explain my problem to you with

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.