我从其他人那里继承了一个项目。问题是代码具有setViewController
AppDelegate 内部的方法来在视图之间进行更改。问题是这段代码似乎大量泄漏内存。我一直在尝试修复代码,但我似乎无法做到这一点。您认为最好的解决方案是什么?修复此代码或一起使用导航控制器?
// The Code to change the views
- (void)setViewController:(UIViewController*)viewController
{
[UIView transitionWithView:_window duration:0.5 options:UIViewAnimationOptionTransitionNone animations:^(void)
{
BOOL oldState = [UIView areAnimationsEnabled];
[UIView setAnimationsEnabled:NO];
_window.rootViewController = viewController;
[UIView setAnimationsEnabled:oldState];
}
completion:nil];
}
// The calls to the setViewController
-(void) gotoHowToUseView{
[self setViewController:[[[HowToVC alloc] initWithNibName:@"HowToVC" bundle:nil] autorelease]];
}
-(void) gotoHowToCredits{
[self setViewController:[[[CreditsVC alloc] initWithNibName:@"CreditsVC" bundle:nil] autorelease]];
}