UIView在调用[self DismissModalViewController初始化:是]后不显示;

UIView在调用[self DismissModalViewController初始化:是]后不显示;,uiview,ios5,Uiview,Ios5,所以这件事让我很难堪 我展示了一个导航控制器,按下一个按钮后,该控制器向其父控制器发送一个通知,该通知执行: -(void)dismissModalWithUpload:(NSNotification *)notification { [self dismissModalViewControllerAnimated:YES]; [self performSelectorInBackground:@selector(executeUpload:) withObject:notifi

所以这件事让我很难堪

我展示了一个导航控制器,按下一个按钮后,该控制器向其父控制器发送一个通知,该通知执行:

-(void)dismissModalWithUpload:(NSNotification *)notification
{
    [self dismissModalViewControllerAnimated:YES];
    [self performSelectorInBackground:@selector(executeUpload:) withObject:notification];
}
模态对话框关闭,一切正常。在随后的调用executeUpload中,我尝试取消隐藏一个包含进度指示器的视图,以执行其他一些工作:

[self performSelectorOnMainThread:@selector(showProgressBar:) withObject:nil waitUntilDone:YES];
…问题是,在executeUpload中的任务完成之前,进度不会出现。我一直在尝试各种背景知识,以使这项工作,但没有任何成功。有什么想法吗

我还尝试使用以下内容作为上传的背景:

dispatch_queue_t myCustomQueue = dispatch_queue_create("com.freethinker.uploadQueue", NULL);

dispatch_async(myCustomQueue, ^{
    [self executeUpload:notification];
});

好了,我终于弄清了真相。诀窍是在解除模态视图控制器之前显示底层进度视图[progressBaseView setHidden:NO]

其余的想法是正确的——所有繁重的工作都发生在后台,同时在主线程上更新UI