3

我有一个UIViewController从中呈现模态视图的视图。

[self presentViewController:modal animated:YES completion:nil];

它有两个UIBarButtonItems(名为CancelSave)。我正在点击保存按钮执行一些操作。我SVProgressHUD在方法上显示指标-saveButtonTapped

- (IBAction)saveButtonTapped:(id)sender
{
    NSLog(@"Modal Save Pressed.");
    [SVProgressHUD showWithStatus:@"Loading..."];
    // Some other code...
}

问题是指示器没有显示在我的ModalView. 它开始动画,但在 后面ModalView,而不是前面。


怎么了 :

UIViewController ===> SVProgressHUD ===> ModalView

我想要的是 :

UIViewController ===> ModalView ===> SVProgressHUD


搜索但没有找到任何解决方案。

为什么会发生这种情况以及如何解决这个问题?

4

1 回答 1

0

最后,我必须使用NSThread来管理这个问题。

实际上,我正在调用一种以-postForEditDispatch我的方法命名的-saveButtonTapped方法。我使用创建了一个单独的线程-detachNewThreadSelector:toTarget:withObject:并尝试在该线程上调用该方法。

示例代码:

- (IBAction)saveButtonTapped:(id)sender
{
    NSLog(@"Modal Save Pressed.");
    [SVProgressHUD showWithStatus:@"Loading..."];
    // Some other code...

    [NSThread detachNewThreadSelector:@selector(postForEditDispatch:) toTarget:self withObject:nil];
}
于 2013-12-02T07:07:50.497 回答