Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 645
Rishi Khanna Avatar asked Feb 20 '15 06:02

Rishi Khanna


1 Answers

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];
}
like image 88
Brian Avatar answered Nov 03 '22 16:11

Brian