-1
XYZAppDelegate *appdelegate=[[UIApplication sharedApplication] delegate];
CSelectorViewController *cPrice=[[CSelectorViewController alloc] initWithNibName:@"CSelectorViewController" bundle:nil];
[cPrice.view setFrame:CGRectMake(0, 20, 320, 480)];
[appdelegate.window addSubview:cPrice.view];
[self applyAnimation];
[cPrice release];
我加入這樣的圖,不使用navigationcontroller,因爲我必須切換兩個視圖當我給予[cPrice釋放]上下also.but;該應用程序崩潰。但是當我沒有在代碼中給它...靜態分析器顯示警告什麼是正確的方式來做到這一點?切換兩個視圖導致崩潰
-(void)applyAnimation
{
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
XYZAppDelegate *appdelegate=[[UIApplication sharedApplication] delegate];
[[appdelegate.window layer] addAnimation:animation forKey:@"slideLeft"];
}
與什麼錯誤崩潰?控制檯中有什麼? –
發送到釋放實例的消息...我知道它由於內存問題,只是想知道什麼是正確的方式來做...沒有內存泄漏 – sujith1406