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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:00:30+00:00 2026-06-13T10:00:30+00:00

I have about 10 objects on an app’s interface. These objects are basically a

  • 0

I have about 10 objects on an app’s interface. These objects are basically a button that has a glow showing which button is active as a given time. When a button is selected its glow is turned on and all other buttons’ glow are turned off.

To turn the glows on and off, I had this

[buttons enumerateObjectsWithOptions:NSEnumerationConcurrent
                                     usingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
    if (obj == sender)
            [(myButtonClass *)obj showGlow];
    else {
            [(myButtonClass *)obj hideGlow];
    }
}];

but I was forced to change to this

[buttons enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {

    if (obj == sender)
            [(myButtonClass *)obj showGlow];
    else {
            [(myButtonClass *)obj hideGlow];
    }
}];

removing the concurrent part of the enumeration. The problem was that for some buttons in particular, the glow was taking 5 seconds to change on or off, but just for the same buttons all the time. The impression I had is that they were in a kind of queue being processed in order (?????!!!)

The showGlow/hideGlow methods are basically two lines: setting a variable and setting the hidden property of the glow imageView on and off. So, these are fast methods for all buttons.

What I don’t understand is why the problem happened for some buttons but not for others and why a block takes so long to process when the app is basically idle.

any clues? thanks.

  • 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-13T10:00:31+00:00Added an answer on June 13, 2026 at 10:00 am

    One reason for the “slow” UI update could be that, when using the NSEnumerationConcurrent option, the enumeration happens on a thread other that the main thread. Since all UI updates should happen on the main thread, your UI changes wont get reflected right away, but instead after a delay when the run loop flushes all the changes made.

    In your case you have only 10 objects, which doesn’t justify using the concurrent option. Besides, why complicate the code with blocks when you can just use the easy readable, and or that matter the fast enumeration, forin:

    for (UIButton *button in buttons) {
        if (button == sender) [button showGlow];
        else [button hideGlow];
    }
    

    You can experiment and observe the same delayed UI update if you start an activity indicator somewhere, then stop it in a background thread. It will be a couple of seconds till it actually stops.

    If you insist on using blocks, you have to call all UIKit methods in the main thread:

    [buttons enumerateObjectsWithOptions:NSEnumerationConcurrent
                                     usingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
        if (obj == sender)
            // One possibility with GCD and dispatch_async on the main queue
            dispatch_async(dispatch_queue_get_main(), ^{[(myButtonClass *)obj showGlow];});
        else {
            // another possibility to call the selector on the main thread
            [(myButtonClass *)obj performSelectorOnMainThread:@selector(hideGlow)];
        }
    }];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mutable array that has about 100 objects in it and each
I have an application that has several objects (about 50 so far, but growing).
I have an app objects and image objects which are linked to one another
I have a Core Data database of about 500 objects. These objects are 'cards'
I have an iOS app with a list of objects. Each object has some
I am working on a multithread app that has about 4 basic Entities at
I have a caching bean that I use to look up/store information about objects
I have a Windows Forms app that displays a list of objects in a
I have multiple objects moving about in a 3D space and am looking for
I have some questions about vector in STL to clarify..... Where are the objects

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.