0
我有一個視圖,我提出了兩個不同的uiwebviews(從本地html加載)。每次用戶點擊位於導航欄中的按鈕,我都會從一個webview切換到另一個頁面捲曲動畫(捲曲和捲曲)。一切似乎工作正常,但有時應用程序凍結時,用戶點擊該按鈕。在大多數情況下,應用程序凍結時,我repeteadly輕按按鈕,直到應用程序死機,然後我暫停調試和我得到這個:UIWebthreadlock凍結應用程序
self.navigationItem.titleView.userInteractionEnabled = NO; //Disable button interaction until animation is finished
if (self.isVisibleFrontView)
{
self.isVisibleFrontView = NO;
[UIView transitionWithView:self.view
duration:0.5
options:UIViewAnimationOptionTransitionCurlUp | UIViewAnimationOptionCurveEaseInOut
animations:^{
[[[self.view subviews] objectAtIndex:0] removeFromSuperview];
[self.view addSubview:self.patientViewReverse];
}
completion:^(BOOL finished){
self.navigationItem.titleView.userInteractionEnabled = YES;
}];
}
else
{
self.isVisibleFrontView = YES;
[UIView transitionWithView:self.view
duration:0.5
options:UIViewAnimationOptionTransitionCurlDown | UIViewAnimationOptionCurveEaseInOut
animations:^{
[[[self.view subviews] objectAtIndex:0] removeFromSuperview];
[self.view addSubview:self.patientView];
}
completion:^(BOOL finished){
self.navigationItem.titleView.userInteractionEnabled = YES;
}];
}
[self showNavigationBarButtons]; //change button image
}
我覺得Webview是獲取鎖時removeFromSuperview但在某些病例從不釋放它,導致主線程凍結。你怎麼看?在不凍結應用程序的情況下實現此目標的最佳方法是什麼?
在此先感謝你們。