iosxamarin.iosxamarinuitabbarcontrollersvprogresshud

Showing a masked BTProgressHUD without blocking the tab bar?


Is it possible to show a BTProgressHUD with a mask without preventing interaction with the tab bar? In other words, can the mask on a BTProgressHUD be constrained to just the tab's currently shown view controller instead of the full window?

BTProgressHUD.Show(status: "Oh hai", maskType: ProgressHUD.MaskType.Gradient);

BTProgressHUD mask blocks the ability to switch tabs.

I am trying to swap out MTMBProgressHUD for BTProgressHUD (because reasons). Unfortunately, when I show a BTProgressHUD with a mask, it will block the user from selecting another tab while it is shown (something MTMBProgressHUD didn't prevent). I definitely need to block any progression/interaction within the current tab's view controller, but I don't mind if the user switches to another tab instead of waiting for the current tab to complete whatever task is requiring the progress HUD.

Here is the full sample code Gist. It is a bit more complex since it includes the tab bar controller and each tab needs to be able to control their own individual HUDs (when this issue is resolved).


Solution

  • After some discussion on Twitter with the creator of BTProgressHUD, it was determined this isn't possible in the current v1.15 release. He suggesting modifying the source to make this happen. I was able to put together the a working version in just a few lines. (It would still need work to integrate with the BTProgressHUD.Show methods that use a shared instance, but I need discrete HUDs per tabs.)

    If you build from this fork, you can then create a BTProgressHUD with a parent view (vs. defaulting to the window) which will restrict the coverage of the overlay mask.

    var progressHud = new ProgressHUD(View); // ctor overload requires the forked version
    progressHud.Show(status: labelText, maskType: ProgressHUD.MaskType.Gradient);
    

    Animated GIF showing tab switching while a HUD is shown