如何将MBProgressHUD的位置固定在UITableView的中心 [英] How to fix the position of MBProgressHUD to center in a UITableView

查看:289
本文介绍了如何将MBProgressHUD的位置固定在UITableView的中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种情况,我在 UITableViewController 上使用第三方库 MBProgressHUD 每当我上下滚动时,HUD都会随着滚动而移动.

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.

我不想禁用UITableView滚动,而且我想将HUD保持在UITableView的中心.

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?

推荐答案

在表视图的超级视图或navigationController.view中添加HUD可以解决此问题:

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];
}

这篇关于如何将MBProgressHUD的位置固定在UITableView的中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆