在我的webViewDidFinishLoad
方法中,我有以下代码:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
if (hasPressed == 1) {
hasPressed = 0;
isBlocked = 0;
}
else if (hasPressed == 0 && hasDroppedDown == 0) {
if (viewState != kStateWeather || isBlocked == 0) {
[UIView animateWithDuration:0.5
delay:0.0 options:UIViewAnimationCurveLinear animations:^{
//Animations
}
completion:^(BOOL finished){
hasDroppedDown = 1;
}];
}
}
}
正如你所看到的,如果这个方法被快速调用,例如一个有重定向的网站,我的else
in myelse if
变得毫无用处。我如何阻止它被如此迅速地调用?