objective-ccllocationmanagernsthreadmbprogresshud

MBProgressHUD blocking user interaction


My application has a MBProgressHUD on the screen while the CLLocationManager is getting the user current location at a separate thread in the background. Sometimes the location process start to take so long and obviously I would like to let the user decide to leave or not the screen. The problem is that the User Interface seems to be blocked by the MBProgressHUD so the user can't press the back button.

Is there any implementation design to solve this problem?


Solution

  • In order to achieve a non-modal behavior, simply disable the user interaction on the MBProgressHUD so that the touches will fall through it.

    Objective-C

    theHUD.userInteractionEnabled = NO;
    

    Swift 4.x

    theHUD.isUserInteractionEnabled = false