i have tableview,detailview ,and favoriteview in my app.when user touch cell in tableview will go to detailview thats contain photo,label,textfield and button for add to favorite.user can touch favorite button to add specific cell to favoritetableview. i can succefullly add cell to favoritetableview but when i touch cell in favoritetableview and go to detail view , nothing load in detailtableview ( photo and textfield and etc) just only can send name to detailview how can i send photo and textfield and etc to detailview from favoriteview? how can i reach to detailview from favoriteview same as maintableview?
Any ideas would be appreciated. Thanks.
this is my model photo: [enter image description here][1]
this is prepareforsegue method for every view:
maintableview:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"SpeciesDetail"]) {
GeneralViewController *detailViewController = (GeneralViewController*)[segue destinationViewController];
NSIndexPath *path = [self.tableView indexPathForSelectedRow];
BirdInfo *info;
BirdImage *imageObj;
if (!_didSearch) {
info = (BirdInfo *)[self.fetchedResultsController objectAtIndexPath:path];
imageObj = info.thumbnailImage;
} else {
info =(BirdInfo *)_searchResult[path.row];
}
detailViewController.birdName = info.com_name;
detailViewController.sciName = info.sci_name;
detailViewController.desbird = info.descriptionbird;
detailViewController.birdInfo = info;
detailViewController.managedOjbectContext = self.managedOjbectContext;
}
}
Favoritetableview:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NSIndexPath *indexPath = (NSIndexPath *)sender;
// NSIndexPath *indexPath =[self.tableView indexPathForSelectedRow];
Favorite *fav = (Favorite *)[self.fetchedResultsController objectAtIndexPath:indexPath];
NSString *combinedName = fav.name;
if ([segue.identifier isEqualToString:@"FavoriteBirdDetail"])
{
GeneralViewController *detailViewController = (GeneralViewController*)[segue destinationViewController];
detailViewController.birdName = [combinedName componentsSeparatedByString:@"^"][0];
NSArray *anArray = [combinedName componentsSeparatedByString:@"^"];
if ( anArray.count >= 2) {
detailViewController.sciName = anArray[1];
//detailViewController.birdInfo=fav.birdInfo;
}
detailViewController.managedOjbectContext = self.managedOjbectContext;
}
and my storyboard
enter image description here