[英]uinavigationcontroller warning in xcode 4.5.1
我在xcode-4.2中進行了編碼,並更新了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];
}
在viewWillAppear:
或viewDidAppear:
調用此方法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];
}
嘗試這個
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.