Adds name to monster detail view.

Passes the selected monster from the search view to the monster detail view.
This commit is contained in:
2020-09-06 13:09:03 -07:00
parent 2f57c10a5a
commit 32025eb4e7
4 changed files with 32 additions and 17 deletions

View File

@@ -7,11 +7,16 @@
//
#import <UIKit/UIKit.h>
#import "Monster.h"
NS_ASSUME_NONNULL_BEGIN
@interface MonsterViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *monsterName;
@property Monster* monster;
@end
NS_ASSUME_NONNULL_END

View File

@@ -16,6 +16,7 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.monsterName.text = _monster.name;
// Do any additional setup after loading the view.
}

View File

@@ -33,15 +33,18 @@
// Do any additional setup after loading the view.
}
/*
#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 = [_monsters objectAtIndex:indexPath.row];
}
}
*/
#pragma mark - UITableViewDataSource