Javascript UIWebview&;JS效果-导航栏缓存
我使用导航栏实现了UIWebview,任何新访问的页面都将添加到导航堆栈中,但问题是当我在推送新视图之前隐藏某些元素并返回到同一页面时,即使再次显示该元素,该元素仍保持隐藏状态 这是我的JS代码Javascript UIWebview&;JS效果-导航栏缓存,javascript,objective-c,ios,uiwebview,uinavigationbar,Javascript,Objective C,Ios,Uiwebview,Uinavigationbar,我使用导航栏实现了UIWebview,任何新访问的页面都将添加到导航堆栈中,但问题是当我在推送新视图之前隐藏某些元素并返回到同一页面时,即使再次显示该元素,该元素仍保持隐藏状态 这是我的JS代码 jQuery(document).ready(function(){ $('#hello').fadeIn('slow');}); $('.facebook,.location, .mainItem').hide();
jQuery(document).ready(function(){
$('#hello').fadeIn('slow');});
$('.facebook,.location, .mainItem').hide();
$('.facebook,.location, .mainItem').show();
$('.contactIcon').click(function(e){
e.preventDefault();
$('.facebook,.location, .mainItem').fadeOut('slow', function() {
window.location = "contact.html";
});
});
这是Objective-C代码
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
DrillDownWebExampleAppDelegate *appDelegate =
(DrillDownWebExampleAppDelegate *)[[UIApplication sharedApplication] delegate];
if(navigationType == UIWebViewNavigationTypeOther)
{
NSURL *url2 = [request URL];
NSString *URLStr = [url2 absoluteString];
RootViewController* viewController = [[RootViewController alloc] init];
NSString *holder = [self getQueryStringInner:URLStr];
[self getQueryString:URLStr];
if([holder length] != 0 )
{
appDelegate.title =@"Title";
appDelegate.query = queryString;
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];
return NO;
}
}
return YES;
}
你能帮忙吗 我做了一个小把戏,但我认为还有另一种方法 我在window.location之后再次显示了元素
jQuery(document).ready(function(){
$('#hello').fadeIn('slow');});
$('.facebook,.location, .mainItem').hide();
$('.facebook,.location, .mainItem').show();
$('.contactIcon').click(function(e){
e.preventDefault();
$('.facebook,.location, .mainItem').fadeOut('slow', function() {
window.location = "contact.html";
$('.facebook,.location, .mainItem').show();
});
});
它是这样工作的