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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:46:05+00:00 2026-06-07T08:46:05+00:00

I have a refresh button that executes a function to initiate a request and

  • 0

I have a refresh button that executes a function to initiate a request and receive a response. While it’s parsing the response I’m changing my last updated text to keep the user informed on what is going on. I’m hoping though to have the refresh button become the uiactivityindicator while the “procedure” is running. How can I accomplish this? Here is a screenshot of my storyboard to help you get and idea of the setup. Let me know if I can provide anything else. Thanks!

storyboard image

Image below shows how I created the bottom bar through the simulated metrics drop down list to the right.

bottom toolbar

EDIT:

Here is the altered code I used from the marked answer.

// Create UIActivityIndicator UIBarButtonItem
UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
[activityView startAnimating];
UIBarButtonItem *loadingView = [[UIBarButtonItem alloc] initWithCustomView:activityView];

// Toolbar with LoadingView and LastUpdatedTitle with Flex Spacing
[self.navigationController.toolbar setItems:(NSArray *)[NSArray arrayWithObjects: loadingView, self.flexSpaceOne, self.lastUpdated, self.flexSpaceTwo, nil]];

When I wanted to change it back I simply “reset” my items using the same setItems:arrayWithObjets: method. Except that time I would change out the loadingview with self.refreshButton.

  • 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-07T08:46:07+00:00Added an answer on June 7, 2026 at 8:46 am

    Define some ivars to access your toolbar and its items:

    NSMutableArray *toolbarItems;
    IBOutlet UIToolbar *toolbar;
    

    Then, in your method where you kick off the task,

    UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 25, 25)];
    UIBarButtonItem *loadingView = [[UIBarButtonItem alloc] initWithCustomView:activityView];
    [toolbarItems replaceObjectAtIndex:0 withObject:loadingView];
    toolbar.items = toolbarItems;
    

    Then do the reverse when it is done to add your refresh button again.

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

Sidebar

Related Questions

I have a problem. I have two refresh button in differents activities that It
I have a total variable that I update with a refresh get request using
I have a widget that has a refresh button and a textview. Refresh updates
I have often experienced while developing my web applications that pressing F5 or refresh
I have created an activity that refresh quotes when the user clicks a button.
I have a page containing a PrimeFaces (2.2.1) Editor component, a Refresh button and
I have an updatepanel in ASP.NET that does a partial page refresh. I've had
I have the follwing code that provides an auto refresh feature to a WCF
In the example code below I have a button that when clicked reloads the
So I have a dynamically loaded button that is called with the following .live('click')

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.