【发布时间】:2011-04-21 02:06:56
【问题描述】:
由于某种原因,当我关闭我的子视图时,它会导致我的 web 视图出现错误(在父视图中)。我用来关闭子视图的调用:(我不知道这是否是正确的做法)
[normalSplashScreen_vc closeNormalSplashScreen];
给我以下错误:
试图从主线程或web线程以外的线程获取web lock。这可能是从辅助线程调用 UIKit 的结果。现在崩溃了...
我不明白为什么关闭子视图会影响底层 web 视图?
(我认为通过调用 closeNormalSplashScreen 函数我正在关闭主视图,即使它是在子视图中调用的 - 如果是这种情况,我该如何解决这个问题?)
主视图
@interface turfplusViewController : UIViewController {
IBOutlet splashScreen *FirstRunsplashScreen_vc;
IBOutlet NormalSplashScreen *normalSplashScreen_vc;
IBOutlet UIWebView *Webview;
}
@property(nonatomic, retain) splashScreen *FirstRunsplashScreen_vc;
@property(nonatomic, retain) NormalSplashScreen *normalSplashScreen_vc;
// Obviously these functions are declared correctly but for the sake of space
- (void) displayFirstRunSplashScreen {
[self presentModalViewController:FirstRunsplashScreen_vc animated:NO];
}
- (void) displayNormalSplashScreen {
[self presentModalViewController:normalSplashScreen_vc animated:NO];
}
启动画面
两个启动画面基本相同(第一个运行有一个进度条)。
@interface NormalSplashScreen : UIViewController {
IBOutlet UIActivityIndicatorView *NormalActivityIndicator;
}
@property(nonatomic, retain) UIActivityIndicatorView *NormalActivityIndicator;
// Obviously these functions are declared correctly but for the sake of space
- (void) closeNormalSplashScreen {
[self dismissModalViewControllerAnimated:YES];
}
【问题讨论】:
标签: iphone objective-c cocoa-touch memory-management