OK, so say I'm on view A (View A is the second view on the sidebar menu). When I click on the third item on the menu, I am navigated to view B. All works fine so far.
The problem arises when I click on the second item on the menu again. I open the view A, but as it was originally. So in other words, a new instance of view A Controller is not created.
This also happens in another way. My fourth item on the menu is supposed to be another instance of view A controller (let's call it View A+1), but for a different purpose. When I click on the fourth button of the menu, I only get the already created view A, not the view A+1.
The first item of the menu is nothing, I'm using it as title for the menu.
I'm not sure why this happens. This is the code I use in my side menu to navigate:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main"
bundle: nil];
UIViewController *vc ;
if (indexPath.row==0) {
[[SlideNavigationController sharedInstance]closeMenuWithCompletion:nil];
}else{
vc = [mainStoryboard instantiateViewControllerWithIdentifier: [[self.menuItems objectAtIndex:1]objectAtIndex:indexPath.row]];
if (indexPath.row==1) {
//This is where View A is initialised and the purpose is set
[(MyProfileViewController*)vc setPurpose:@"Purpose for view A"];
}
if (indexPath.row==2) {
//This is where View A is initialised and the purpose is set
//I don't pass anything to the view B (which is in the cell with indexPath row of 1)
}
if (indexPath.row==3) {
[(MyProfileViewController*)vc setPurpose:@"Purpose for view A+1"];
}
[[SlideNavigationController sharedInstance] popAllAndSwitchToViewController:vc withSlideOutAnimation:self.slideOutAnimationEnabled andCompletion:nil];
}
}
Thanks in advance for any help you can give and if you need more code, please let me know.
OK, so say I'm on view A (View A is the second view on the sidebar menu). When I click on the third item on the menu, I am navigated to view B. All works fine so far.
The problem arises when I click on the second item on the menu again. I open the view A, but as it was originally. So in other words, a new instance of view A Controller is not created.
This also happens in another way. My fourth item on the menu is supposed to be another instance of view A controller (let's call it View A+1), but for a different purpose. When I click on the fourth button of the menu, I only get the already created view A, not the view A+1.
The first item of the menu is nothing, I'm using it as title for the menu.
I'm not sure why this happens. This is the code I use in my side menu to navigate:
Thanks in advance for any help you can give and if you need more code, please let me know.