UINavigationController: push self?
I have a custom class which is a UITableViewController, this is inside of a UINavigationController. Normally, when I click a cell, I push a new class onto the stack and it is fine. This time, I would like to push self onto the stack (passing a different string onLoad so that I load different content), so that I can reuse my code, is this possible? Or do I always have to create a secondary class to push?
Rather than "pushing yourself", you can push a new instance of the same view controller yes. Simply create a new one like so:
MyViewController *viewController = [[MyViewController alloc] initWithNibName:"MyView"]; viewController.customString = @"Something else"; [self.navigationController pushViewController:viewController]; [viewController release];
I haven't tested this, and it's late so there might be bits wrong but you should be ok with that. Let me know if it works!