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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:28:43+00:00 2026-05-25T18:28:43+00:00

I have implemented a refresh button of style UIBarSystemItem which will be disabled for

  • 0

I have implemented a refresh button of style UIBarSystemItem which will be disabled for 10s whenever it is pressed.

I want to further improve it by showing the time left before it is enabled. What is the quickest way to do it?

Many thanks in advance.

Called whenever the button is pressed.

-(void)refreshButton {
[self performSelector:@selector(enableRefreshButton) withObject:nil afterDelay:10];
self.navigationItem.rightBarButtonItem.enabled = NO;
}

-(void)enableRefreshButton {
self.navigationItem.rightBarButtonItem.enabled = YES;
}

EDIT: The refresh button is of style UIBARSystemItemRefresh.

I am currently doing this as the answer suggests I use NSTimer. The button does get enabled and disable accordingly but the text doesn’t change.

@inteface ... {
    int count;
}
-(void)viewDidLoad{
    UIBarButtonItem *refresh = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refreshButtonPressed)];          
    self.navigationItem.rightBarButtonItem = refresh;
}
-(void)refreshButtonPressed {
    //do something here...
    count = 10;
    self.myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateTimeLeft) userInfo:nil repeats:YES];
}

-(void)updateTimeLeft{
    count --;
    NSLog(@"%i", count);
    self.navigationItem.rightBarButtonItem.title = [NSString stringWithFormat:@"%i", count];
    self.navigationItem.rightBarButtonItem.enabled = NO;
    if (count == 0) {
        self.navigationItem.rightBarButtonItem.enabled = YES;
        [self.myTimer invalidate];
    }
}

Can I use the title property with UIBarButtonSystemItem?

  • 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-25T18:28:43+00:00Added an answer on May 25, 2026 at 6:28 pm

    For this you need to implement NSTimer
    declare int variable count in .h file. and initialize it with count==10 in viewDidLoad/viewWillAppear as your code goes.

    call this method in performSelector

    - (void)updateCount:(NSTimer *)aTimer { 
        count--;
        self.navigationItem.rightBarButtonItem.enabled = YES;
        self.navigationItem.rightBarButtonItem.title = [NSString stringWithFormat:@"%d",count];
        NSLog(@"%i", count); 
        if (count == 0) { 
            self.navigationItem.rightBarButtonItem.enabled = NO;
            self.navigationItem.rightBarButtonItem.title = [NSString stringWithFormat:@"YOUR BAR BUTTON NAME"];
            [timer invalidate];
            timer = nil;
        } 
    } 
    

    EDIT

    I think this link would definitely solved problem. This is almost same as you were asking. Please go through the link. http://www.richardhyland.com/diary/2008/12/21/some-cool-tips-and-tricks-for-the-iphone-sdk/

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

Sidebar

Related Questions

I have implemented a thread in android which refresh the fragment (some text list
I have implemented Facebook into my app but now I find that whenever I
Hi my app contains a refresh button,onclick of that I want to display list
I have an image button on a pop up page which is opened by
I have a problem with a menu button called Refresh that lags for a
I have implemented a Pull to refresh in my tableView like the iPhone app
I have implemented pagination using the will_paginate plugin. I want have a drop down
I have implemented correctly bump's api, and added this code: - (void) configureBump {
I have implemented pagination to my data, but the problem is I only have
I have implemented a table view with multiple threads. Currently when a user taps

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.