0

我有一个 SplitView,当用户触摸 MasterView 中的特定单元格时,我需要全屏显示 ModalView,以便将数据加载到 DetailView 中。这个 ModalView 是一个巨大的 TableView,所以我需要添加一个 Spinner 作为用户的反馈。我通过在 MasterView 的 didSelectRow 中调用一个方法添加了一个 MBProgressHUD,但它并没有立即出现;该应用程序加载了巨大的表格,然后出现了HUD,但在那一刻它是无用的。那么,为什么它需要等待表格加载才能出现呢?

这是我在伪代码中的逻辑:

在 MasterViewController

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if(indexPath.section==0 && indexPath.row==5) {
        HUD = [MBProgressHUD showHUDAddedTo:((AppDelegate*)[[UIApplication sharedApplication] delegate]).window.rootViewController.view animated:YES];
        HUD.labelText = @"Loading";
        HUD.labelFont = [UIFont systemFontOfSize:18];
        HUD.delegate = self;
        [self performSegueWithIdentifier:@"MyModalView" sender:self];
    }

     }

在我的模态视图中

- (void)viewDidLoad {
    // load all stuff related to table data
    [self removeHUD];
}

我的问题与执行 segue 时显示的一个 HUD 非常相似, 其中我添加了另一个部分解决方案,但是通过使用该建议,如果我在横向和纵向中使用该应用程序,我会有一个奇怪的旋转它不起作用。

4

1 回答 1

-1

在你看来确实加载了

 HUD=[[MBProgressHUD alloc] initWithView:self.view];
HUD.labelText=@"Wait...";
[self.view HUD];
[HUD setDelegate:self];

并使用 [HUD show:YES];和 [HUD 隐藏:是];在需要时

于 2013-08-31T10:55:32.437 回答