0

I m new to storyboard, in my application i have story board with name "LeftMenuList" in this i have created table view controller manually and place table view to self.view, now i wan't unwind segue from table view cell selection for root view controller.

For this i read multiple document related to unwind segue.

  1. https://www.youtube.com/watch?v=Zc8Ez9YfBSM
  2. http://spin.atomicobject.com/2014/12/01/program-ios-unwind-segue/ etc..

but in every document button's are created using storyboard and for connection just cntr+drag from button to exit.

But as i said earlier my table view is created manually so i m not able connect selected cell to exit for creating unwind segue (go back to login view), so can any buddy help me how can i solved my issue..For more clarification i will attach screen shot.

Root View Controller -Login Screen -- Click on submit button-- VC2 open

on top left corner there is on button like option on click of this left menu list will open

LeftMenuList view controller is story board view but table view created manually, now i want to go back to root view controller on table view cell selection.

Code :---

1) In Viewcontroller.m (root View-Login Screen) added below method as i wan't this view on unwind segue:-

-(IBAction)UnwindSegueToRootViewController:(UIStoryboardSegue *)segue
{

}

2) In leftMenuList.m (in this view controller i m having table view cell on-- cell selection(logout) need to go back login screen -- so below is didSelectRowAtIndexPath)

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    self.strSelectedOption = [self.arrOfMenu objectAtIndex:indexPath.row];

    if ([self.strSelectedOption isEqualToString:@"Logout"])
    {
        [self performSegueWithIdentifier:@"UnwindSegueToRootViewController" sender:self];
//        [self shouldPerformSegueWithIdentifier:@"UnwindSegueToRootViewController" sender:self];

    }

}

And below Screen shot shows identifier connection

enter image description here

John Saunders
  • 157,405
  • 24
  • 229
  • 388
Priyanka
  • 479
  • 8
  • 24
  • 1
    Take a look at this answer: http://stackoverflow.com/questions/12509422/how-to-perform-unwind-segue-programmatically – Kevin Horgan Apr 21 '15 at 07:32
  • Hi kevin, Thank you for comment, as i created sample demo as per ur suggested link it's working fine for me,but when ever i m trying to implement in main project it throws an error "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'UnwindSegueToRootViewController'' *** First throw call stack:" – Priyanka Apr 21 '15 at 10:27
  • /Users/giftechnologiesmac2/Desktop/1.tiff , in my view controller ---(IBAction)UnwindSegueToRootViewController:(UIStoryboardSegue *)segue { } and in leftmenulist--table view --- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { self.strSelectedOption = [self.arrOfMenu objectAtIndex:indexPath.row]; if ([self.strSelectedOption isEqualToString:@"Logout"]) { [self performSegueWithIdentifier:@"UnwindSegueToRootViewController" sender:self]; } } – Priyanka Apr 21 '15 at 10:28
  • Could you post your code in the question above to make it easier to see what is going on? – Kevin Horgan Apr 21 '15 at 11:01
  • hi kevin please check , i have added my code. – Priyanka Apr 21 '15 at 11:29
  • Have you tried adding a debug print command in your if statement "if ([self.strSelectedOption isEqualToString:@"Logout"])" to see if you are actually getting the right cell value back? As far as I can see the unwind Segue looks OK. – Kevin Horgan Apr 21 '15 at 11:39
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/75811/discussion-between-kevin-horgan-and-spypriyanka). – Kevin Horgan Apr 21 '15 at 12:05
  • Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on [so]. See "[Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts). BTW, it's "Thanks in advance", not "Thanks in advanced". – John Saunders Apr 26 '15 at 18:27
  • Resolved my issue.. For this i have created one delegate method of left menu class – Priyanka Apr 28 '15 at 11:38

0 Answers0