简体   繁体   English

显示遮罩的BTProgressHUD而不阻止选项卡栏?

[英]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? 是否可以在不阻止与选项卡栏交互的情况下显示带掩码的BTProgressHUD? 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上的遮罩限制为仅显示选项卡当前显示的视图控制器,而不是整个窗口?

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

BTProgressHUD遮罩阻止切换选项卡的功能。

I am trying to swap out MTMBProgressHUD for BTProgressHUD (because reasons ). 我正在尝试将MTMBProgressHUD换成BTProgressHUD(由于原因 )。 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). 不幸的是,当我显示带掩码的BTProgressHUD时,它会阻止用户在显示该选项卡时选择另一个选项卡(MTMBProgressHUD不能阻止该操作)。 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. 我绝对需要阻止当前选项卡的视图控制器内的任何进度/交互,但是我不介意用户是否切换到另一个选项卡,而不是等待当前选项卡完成需要进度HUD的任务。

Here is the full sample code Gist . 这是完整的示例代码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). 由于它包含选项卡栏控制器,并且每个选项卡需要能够控制自己的单独HUD(解决此问题后),因此它有点复杂。

After some discussion on Twitter with the creator of BTProgressHUD, it was determined this isn't possible in the current v1.15 release. Twitter上与BTProgressHUD的创建者进行了讨论之后,确定在当前的v1.15版本中这是不可能的。 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.) (它仍需要与使用共享实例的BTProgressHUD.Show方法集成的工作,但每个选项卡我需要离散的HUD。)

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. 如果从此分支构建,则可以使用父视图(相对于默认窗口)创建BTProgressHUD,这将限制覆盖蒙版的覆盖范围。

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

动画GIF,显示HUD时显示选项卡切换

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM