Question

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
}
Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top