I\'m trying to switch back from my UIViewController to my UITableViewController but apperendly it\'s not working the way I want it to. I did create my Interface with storybo
You don't push back. That creates a new instance of the previous controller class. You pop back. You can accomplish that 2 ways.
1: In code put in the following statement when you want to return (pop) to you tablet view controller.
[self.navigationController popViewControllerAnimated:YES];
2: If you want to do it in storyboard you need to implement the following custom segue class:
implementation
// PopSegue.m
#import "PopSegue.h"
@implementation PopSegue
- (void) perform {
UIViewController *src = (UIViewController *) self.sourceViewController;
[src.navigationController popViewControllerAnimated:YES];
}
and header
// PopSegue.h
#import
@interface PopSegue : UIStoryboardSegue
@end
Place this method in your UIViewController to set a property back to your UITableViewController:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"goBackToTableView"]) {
[[segue destinationViewController] set{whatEverProperyYouWantTo}: {valueOfPropertyToSet}];
}
}