Makes the library view display a list of monsters.

Makes the library view ad search view share a view controller for their destination.
This commit is contained in:
2020-09-11 23:39:50 -07:00
parent 314906f74d
commit b1fbc169dc
6 changed files with 165 additions and 36 deletions

View File

@@ -29,14 +29,13 @@
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
if ([@"ShowMonsterDetail" isEqualToString:segue.identifier]) {
NSIndexPath *indexPath = [self.searchResults indexPathForSelectedRow];
MonsterViewController *vc = (MonsterViewController*)segue.destinationViewController;
vc.monster = [self.foundMonsters objectAtIndex:indexPath.row];
if ([segue.destinationViewController isKindOfClass:[MonsterViewController class]]) {
MonsterViewController *vc = (MonsterViewController*)segue.destinationViewController;
vc.monster = [self.foundMonsters objectAtIndex:indexPath.row];
}
}
}