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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:14:25+00:00 2026-06-10T01:14:25+00:00

In my Project, each of the user interaction events make a network call (Which

  • 0

In my Project, each of the user interaction events make a network call (Which is TCP, not HTTP). I need Activity Indicator to be global to show from a random UIViewController and hide from NetworkActivityManager Class (a custom class to handle network activities, Which is not a subclass of UIViewController or UIView).

After searching the web I found out that MBProgressHUD is used for the same purpose, but I wasn’t able to find out an example on how would I use it globally. (By saying global I mean a singleton object of MBProgressHUD and class methods to SHOW and HIDE it.)

Following is what I have tried yet, but, failed:
In AppDelegate.h:

@property (nonatomic, retain) MBProgressHUD *hud;

In AppDelegate.m:

@synthesize hud;

In some random UIViewController object:

appDelegate.hud = [MBProgressHUD showHUDAddedTo:appDelegate.navigationController.topViewController.view animated:YES];
appDelegate.hud.labelText = @"This will take some time.";

And while hiding it, from NetworkActivityManager Class:

[MBProgressHUD hideHUDForView:appDelegate.navigationController.topViewController.view animated:YES];

This makes the project to crash after some time (due to memory issues.)
I am using ARC in my project and also, I am using the ARC version of MBProgressHUD.

Am I missing something?

Important Question:

Can I make MBProgressHUD work like UIAlertView? (Saying that I mean implementation of MBProgressHUD independent of UIView — sa it uses showHUDAddedTo: to present itself) ???

Please Note: In the above code of hiding MBProgressHUD, View may be changed from what it was when showing MBProgressHUD.

Any Help greatly appreciated.

  • 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-10T01:14:27+00:00Added an answer on June 10, 2026 at 1:14 am

    You could add this to a class of your liking:

    + (MBProgressHUD *)showGlobalProgressHUDWithTitle:(NSString *)title {
        UIWindow *window = [[[UIApplication sharedApplication] windows] lastObject];
        MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:window animated:YES];
        hud.labelText = title;
        return hud;
    }
    
    + (void)dismissGlobalHUD {
        UIWindow *window = [[[UIApplication sharedApplication] windows] lastObject];
        [MBProgressHUD hideHUDForView:window animated:YES];
    }
    

    This can be than called on any class. You don’t need to keep a strong reference to the HUD when using those class convenience methods.

    Depending on your specific situation you’ll probably also want to handle cases where a new hud is requested before the other one is hidden. You could eater hide the previous hud when a new comes in or come up with some sort of queueing, etc.

    Hiding the previous HUD instance before showing a new one is pretty straightforward.

    + (MBProgressHUD *)showGlobalProgressHUDWithTitle:(NSString *)title {
        UIWindow *window = [[[UIApplication sharedApplication] windows] lastObject];
        [MBProgressHUD hideAllHUDsForView:window animated:YES];
        MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:window animated:YES];
        hud.labelText = title;
        return hud;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My project had audit module, which includes each and every action of the user
I am working in a project where each user has a big avatar and
I got a website which contains a lot of projects with each project containing
in my project i need a tow tables each of it has about 2000
CONTEXT: My project is a CMS website, and each user's CSS is held in
I have the project organized in this way: User is the main resource, each
I'm working on a project, this project must have many users, each user can
CruiseControl.net creates (by default) for each project a subdirectory under: c:\Program File\CruiseControl.NET\server How can
Basically I have a series of projects displayed on the page. Each project consists
For each of the different types of windows in my project I created a

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.