我在 wich 中看到两种不同的 uiwebview( 从本地 html 上载 ) 。 每次用户按下导航栏中的一个按钮, 我就会用一个网络视图转换成另一个页面卷曲动画( 向上弯曲, 向下弯曲 ) 。 似乎一切都很好, 但当用户按下按钮时, 程序有时会冻结。 在多数情况下, 当我按下按钮重写时, 程序会冻结, 直到应用程序冻结, 然后我暂停调试程序, 我得到这个消息 :
""https://i.sstatic.net/hDwB.png" alt="此处输入图像描述"/ >
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在移除“从审查”时正在获取锁,但在某些情况下从未释放它,导致主线冻结。你认为怎样?在不冻结应用程序的情况下实现这一点的最佳方法是什么?
感谢大家提前。