iphone - UIAlertView 不关闭
<p><p>我在按钮单击或 (IBAction) 中使用以下内容</p>
<pre><code>- (IBAction)HistoryBtn:(id)sender {
self startReport];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//============================
so some long processing code
//============================
;
});
}
</code></pre>
<p>在哪里</p>
<pre><code>-(void) startReport
{
alert = [ initWithTitle:@"Generating PDF" message:@" " delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
UIActivityIndicatorView *progress= [ initWithFrame:CGRectMake(125, 50, 30, 30)];
progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
;
;
;
;
}
-(void) stopReport
{
NSLog(@"Stop Called");
;
self.alert = nil;
NSLog(@"Stop Called");
}
</code></pre>
<p>问题是 AlertView 弹出窗口,我可以看到按钮工作,然后调用 StopReport 但 AlertView 停留在那里我怎样才能让 AlertView 消失</p>
<p>提前致谢</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您必须只在主线程上使用 UI。</p>
<pre><code> - (IBAction)HistoryBtn:(id)sender {
self startReport];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//============================
so some long processing code
//============================
dispatch_async(dispatch_get_main_queue(), ^{
;
});
});
}
</code></pre></p>
<p style="font-size: 20px;">关于iphone - UIAlertView 不关闭,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/11485990/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/11485990/
</a>
</p>
页:
[1]