I\'m trying to replace my current viewController with a new one. I\'ve been able to do this before but I\'m having some issues with BAD_ACCESS.
This is the code tha
Use category for controller replace:
// UINavigationController+ReplaceStack.h
@interface UINavigationController (ReplaceStack)
- (void) replaceLastWith:(UIViewController *) controller;
@end
// UINavigationController+ReplaceStack.m
#import "UINavigationController+ReplaceStack.h"
@implementation UINavigationController (ReplaceStack)
- (void) replaceLastWith:(UIViewController *) controller {
NSMutableArray *stackViewControllers = [NSMutableArray arrayWithArray:self.viewControllers];
[stackViewControllers removeLastObject];
[stackViewControllers addObject:controller];
[self setViewControllers:stackViewControllers animated:YES];
}
@end