-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