2012-07-26 74 views
0

我用导航栏实现了UIWebview,任何新访问过的页面都会被添加到导航栈中,但问题是当我在推送新视图之前隐藏一些元素并返回到同一页面元素保持隐藏,即使我再次显示它UIWebview&JS效果 - 导航栏缓存

这里是我的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 [email protected]"Title"; 
     appDelegate.query = queryString; 
     [self.navigationController pushViewController:viewController animated:YES]; 
     [viewController release]; 
     return NO; 
    } 



} 
return YES; 
} 

能ÿ ou请帮忙吗?

回答

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(); 
    }); 
}); 

它的工作原理是这样

后再次