我使用导航栏实现了UIWebview,任何新访问过的页面都会被添加到导航堆栈中,但问题是当我在推送新视图之前隐藏某个元素并返回同一页面时,即使我显示该元素也会隐藏它再次
这是我的JS代码
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;
}
你能帮忙吗?
答案 0 :(得分:0)
我做了一个小技巧,但我认为还有另一种方法
我在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();
});
});
它像这样工作