How to fix the position of MBProgressHUD to center in a UITableView

ios, mbprogresshud, objective-c, uirefreshcontrol, uitableview

Solution

Adding HUD to the tableview's super view or `navigationController.view` fixes the problem:

UIView *view = self.tableView.superview;
// UIView *view = self.navigationController.view; if you are using navigationController
if (view != nil) {
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
}

Problem

I have a scenario where I am using third party library MBProgressHUD on a UITableViewController but the issues is whenever I scroll up and down the HUD moves with the scroll. I don't want to disable the UITableView scroll and also I want to keep the HUD in the centre of the UITableView. Is there a possible way of implementing it?

Original source