Disabling user interaction not working in SVProgressHUD on iOS app

て烟熏妆下的殇ゞ 提交于 2020-01-13 11:12:27

问题


I've just downloaded SVProgressHUD and incorporated it into my project as explained in the github documentation page, but even if I wrote out [SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeGradient];, it's not different from the default mask type, and when I tapped the screen while the cursor was revolving I got my app crashed - meaning I wasn't able to disable the user interaction feature since my app crashes before showing all of the table view cells there.

And note that clear or black mask type didn't work, either.

So how can I successfully disable the user interaction? And which file of the AppDelegate.m's applicationDidFinishWithLaunchingOptions: and FirstViewController.'s viewDidLoad: should I write the above code?

I use the latest version of the SVProgressHUD and use Xcode 5.1 and iOS 7.1. I also use ARC. Am I missing something?

[Update]

This was a bug issue and it has been resolved in the current version. Check it out on the Github page for the further info.


回答1:


You're not missing anything. iOS 7 doesn't seem to respect the mask type, so user interaction is never disabled. I think it's a bug with SVProgressHUD rather than anything else. Bit frustrating really.




回答2:


This is very late to answer but just in case it can help someone because I was stuck with this issue for a while today. If you are using latest classes from github you won't face any issue but if you are using old classes then Replace below method from SVProgressHUD.m as below

+ (void)showWithStatus:(NSString *)status 
  {   
     [self setDefaultMaskType:SVProgressHUDMaskTypeGradient];
     [self showProgress:SVProgressHUDUndefinedProgress status:status];
  }



回答3:


I am using SVProgressHUD with swift and iOS 10.2 . Just setting mask type

In AppDelegate

SVProgressHUD.setDefaultMaskType(.black) works.

and every time you write

SVProgressHUD.show()

it will show the mask and userInteraction is managed by it.




回答4:


It can be done easily by doing some changes in SVProgressHUD class: just put
[self.window setUserInteractionEnabled:NO]; in the last of showprogress with status and put [self.window setUserInteractionEnabled:YES]; in dismiss method.




回答5:


Objective C (AppDelegate.m)

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    //add this line
    [SVProgressHUD setDefaultMaskType: SVProgressHUDMaskTypeBlack];
}


来源:https://stackoverflow.com/questions/22396175/disabling-user-interaction-not-working-in-svprogresshud-on-ios-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!