2012-07-26 57 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(); 
    }); 
}); 

它的工作原理是這樣

後再次