0

I am currently working on an IOS app to browse the folders on a remote computer and display the pictures. Now in order to browse the folders I am using the same table view and updating its cells, each time the user presses on a tile. Now after getting to the final list of contents(Images), I am trying to use a segue to navigate to UIViewController to display the Images. But I am getting an error: "segue not found".

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath  *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
// Fetch device
self->browseObjID = [avObjArray objectAtIndex:indexPath.row];

if([self->browseObjID isFolder])//To load same table view for browsing the folders
{
  ContentL1TableViewController *targetViewController = [[[ContentL1TableViewController alloc] initWithMediaDevice:_devSelected andObjectId:self->browseObjID ];
    [[self navigationController] pushViewController:targetViewController animated:YES];
}
else
 [self performSegueWithIdentifier:@"DisplayImage" sender:self];// display final image
}
bjb568
  • 11,089
  • 11
  • 50
  • 71
hungryspider
  • 300
  • 2
  • 13
  • First, don't use `->` syntax. Second, check the name of the segue in Interface Builder. – dasdom May 12 '14 at 06:16
  • 1
    Probably, either you don't have a segue with that name (spelling?), or the controller you have this code in is not the same instance you connected the segue to in the storyboard. – rdelmar May 12 '14 at 06:16
  • first ur DisplayImage identifier does not match, other wise if u used the storyborad need to identify the storyboard – Anbu.Karthik May 12 '14 at 06:19
  • if u use the storyboard http://stackoverflow.com/questions/23102978/swrevealviewcontroller-without-using-navigationcontroller/23105142#23105142 – Anbu.Karthik May 12 '14 at 06:19
  • Please see my answer. Your view controller is not created from a storyboard (`alloc] initWithMediaDevice...`). Therefore you cannot called perform segue as there are no segues (because there is no storyboard). – Fogmeister May 12 '14 at 07:41

1 Answers1

0

You can only segue from a view controller that is created by a storyboard.

I'm assuming that you defined this TVC in a storyboard initially but that is only the first one.

When you are going to the subsequent TVCs you are creating these using alloc init and so they don't have a storyboard with a segue defined.

You should either create your image view controller using a xib file and load it from the xib or create it in code. Both would be easier.

Or you could define a "circular" segue that goes from the TVC back to itself and use this instead of creating one using alloc init all the time.

Fogmeister
  • 76,236
  • 42
  • 207
  • 306