diff --git a/MonsterCards.xcodeproj/project.pbxproj b/MonsterCards.xcodeproj/project.pbxproj index a256839..a5ca95b 100644 --- a/MonsterCards.xcodeproj/project.pbxproj +++ b/MonsterCards.xcodeproj/project.pbxproj @@ -24,6 +24,7 @@ E25BD60425036CF0007B04EF /* Ability.m in Sources */ = {isa = PBXBuildFile; fileRef = E25BD60325036CF0007B04EF /* Ability.m */; }; E25BD60725036CFA007B04EF /* Action.m in Sources */ = {isa = PBXBuildFile; fileRef = E25BD60625036CFA007B04EF /* Action.m */; }; E2ECA8F32504AC3300C1FFA5 /* SkillTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E2ECA8F22504AC3300C1FFA5 /* SkillTests.m */; }; + E2ECA8F52504BAAD00C1FFA5 /* MonsterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E2ECA8F42504BAAD00C1FFA5 /* MonsterTests.m */; }; E2F7247525005E89007D87ED /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E2F7247425005E89007D87ED /* AppDelegate.m */; }; E2F7247825005E89007D87ED /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E2F7247725005E89007D87ED /* SceneDelegate.m */; }; E2F7248125005E89007D87ED /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E2F7247F25005E89007D87ED /* Main.storyboard */; }; @@ -93,6 +94,7 @@ E25BD60625036CFA007B04EF /* Action.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Action.m; sourceTree = ""; }; E265EE24B2C8E81E1B559306 /* Pods-MonsterCards-MonsterCardsUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MonsterCards-MonsterCardsUITests.debug.xcconfig"; path = "Target Support Files/Pods-MonsterCards-MonsterCardsUITests/Pods-MonsterCards-MonsterCardsUITests.debug.xcconfig"; sourceTree = ""; }; E2ECA8F22504AC3300C1FFA5 /* SkillTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SkillTests.m; sourceTree = ""; }; + E2ECA8F42504BAAD00C1FFA5 /* MonsterTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MonsterTests.m; sourceTree = ""; }; E2F7247025005E89007D87ED /* Monster Cards.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Monster Cards.app"; sourceTree = BUILT_PRODUCTS_DIR; }; E2F7247325005E89007D87ED /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; E2F7247425005E89007D87ED /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -286,6 +288,7 @@ E2FD91E9250493C000D5E935 /* LanguageTests.m */, E2FD91EB250496B000D5E935 /* SavingThrowTests.m */, E2ECA8F22504AC3300C1FFA5 /* SkillTests.m */, + E2ECA8F42504BAAD00C1FFA5 /* MonsterTests.m */, ); path = Models; sourceTree = ""; @@ -556,6 +559,7 @@ E2FD91E82504832A00D5E935 /* DamageTypeTests.m in Sources */, E2FD91EC250496B000D5E935 /* SavingThrowTests.m in Sources */, E2FD91E6250481F300D5E935 /* ActionTests.m in Sources */, + E2ECA8F52504BAAD00C1FFA5 /* MonsterTests.m in Sources */, E2ECA8F32504AC3300C1FFA5 /* SkillTests.m in Sources */, E2FD91E425047C4400D5E935 /* AbilityTests.m in Sources */, E2F7249625005E8A007D87ED /* MonsterCardsTests.m in Sources */, diff --git a/MonsterCards/Base.lproj/Main.storyboard b/MonsterCards/Base.lproj/Main.storyboard index 5dceb75..0dbcdb3 100644 --- a/MonsterCards/Base.lproj/Main.storyboard +++ b/MonsterCards/Base.lproj/Main.storyboard @@ -58,6 +58,10 @@ + + + + @@ -79,6 +83,8 @@ + + diff --git a/MonsterCards/Views/SearchViewController.m b/MonsterCards/Views/SearchViewController.m index 76d026e..b01b929 100644 --- a/MonsterCards/Views/SearchViewController.m +++ b/MonsterCards/Views/SearchViewController.m @@ -8,15 +8,28 @@ #import "SearchViewController.h" #import "MonsterViewController.h" +#import "Monster.h" @interface SearchViewController () @end -@implementation SearchViewController +@implementation SearchViewController { + NSMutableArray *_monsters; +} - (void)viewDidLoad { [super viewDidLoad]; + _searchBar.text = @"Hello, World!"; + _monsters = [[NSMutableArray alloc] init]; + Monster *monster; + monster = [[Monster alloc] init]; + monster.name = @"Pixie"; + [_monsters addObject:monster]; + monster = [[Monster alloc] init]; + monster.name = @"Acolyte"; + [_monsters addObject:monster]; + // Do any additional setup after loading the view. } @@ -30,4 +43,33 @@ } */ +#pragma mark - UITableViewDataSource + +- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section { + return [_monsters count]; +} + +- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath { + static NSString *simpleTableIdentifier = @"SimpleTableItem"; + + UITableViewCell *cell = [_searchResults dequeueReusableCellWithIdentifier:simpleTableIdentifier]; + + if (cell == nil) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier]; + } + + cell.textLabel.text = ((Monster*)[_monsters objectAtIndex:indexPath.row]).name; + + return cell; +} + +#pragma mark - UITableViewDelegate + +// Tap on table Row +- (void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath { + + [self performSegueWithIdentifier:@"ShowMonsterDetail" sender:self]; +} + + @end