2012-10-26 52 views
0

我做了我在xcode-4.2編碼和更新xcode-4.5.1,我的應用程序運行完美,同時單擊窗口導航它顯示以下錯誤。uinavigationcontroller警告在xcode 4.5.1

Warning: Attempt to present <learnview: 0x8876220> on <UINavigationController: 0x8866e10> whose view is not in the window hierarchy! 

我改變從viewDidLoad中()的函數來viewdidappear()仍然是其顯示了同樣的錯誤,請幫我解決了

編輯:

-(void)goright 
    { 
    CATransition* transition = [CATransition animation]; 
    transition.duration = 1.5; 
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 
    transition.type = kCATransitionPush; 
    learnview *lview=[[learnview alloc]initWithNibName:@"learnview" bundle:nil]; 
    transition.subtype = kCATransitionFromRight; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom 
    [self.navigationController.view.layer addAnimation:transition forKey:nil]; 
    [[self navigationController] pushViewController:lview animated:NO]; 

    [imagetim invalidate];  
    }  
+0

你能告訴你如何添加navigationcontroller? –

+0

重複http://stackoverflow.com/questions/11862883/whose-view-is-not-in-the-window-hierarchy??? – iDev

+0

@ForamMukundShah通過編碼我知道的appdelegate – Fazil

回答

0

調用此方法在viewWillAppear:viewDidAppear:

動畫請在下面輸入代碼...

-(void)goright 
{ 
    CATransition *animation = [CATransition animation]; 
    [animation setDelegate:self]; 
    [animation setType:kCATransitionPush]; 
    [animation setDuration:1.5]; 
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName: 
            kCAMediaTimingFunctionEaseInEaseOut]]; 
    [animation setSubtype:kCATransitionFromRight]; 
    [[self.view layer] addAnimation:animation forKey:@"transitionViewAnimation"]; 

    learnview *lview=[[learnview alloc]initWithNibName:@"learnview" bundle:nil]; 
    [[self navigationController] pushViewController:lview animated:NO]; 

    [imagetim invalidate];  
} 

,沒有動畫試試這個下面的代碼...

-(void)goright 
    { 

     learnview *lview=[[learnview alloc]initWithNibName:@"learnview" bundle:nil]; 

     [self.navigationController pushViewController:lview animated:YES]; 

     [imagetim invalidate];  
    }  

試試這個

+0

仍然不能正常工作 – Fazil

+0

我想在你的項目中再次導入你的這個learnview bcoz系統沒有從你的樹中找到這個文件,所以試試這個.. –

+0

propblem cleared.thanks mate – Fazil