Adds placeholder monsters to search view.
Adds navigation from search view to monster detail view.
This commit is contained in:
@@ -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 = "<group>"; };
|
||||
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 = "<group>"; };
|
||||
E2ECA8F22504AC3300C1FFA5 /* SkillTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SkillTests.m; sourceTree = "<group>"; };
|
||||
E2ECA8F42504BAAD00C1FFA5 /* MonsterTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MonsterTests.m; sourceTree = "<group>"; };
|
||||
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 = "<group>"; };
|
||||
E2F7247425005E89007D87ED /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
@@ -286,6 +288,7 @@
|
||||
E2FD91E9250493C000D5E935 /* LanguageTests.m */,
|
||||
E2FD91EB250496B000D5E935 /* SavingThrowTests.m */,
|
||||
E2ECA8F22504AC3300C1FFA5 /* SkillTests.m */,
|
||||
E2ECA8F42504BAAD00C1FFA5 /* MonsterTests.m */,
|
||||
);
|
||||
path = Models;
|
||||
sourceTree = "<group>";
|
||||
@@ -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 */,
|
||||
|
||||
@@ -58,6 +58,10 @@
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<sections/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="IwG-ax-Esn" id="3Ya-Rh-Hn4"/>
|
||||
<outlet property="delegate" destination="IwG-ax-Esn" id="0MV-S6-Rtx"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
@@ -79,6 +83,8 @@
|
||||
</view>
|
||||
<tabBarItem key="tabBarItem" title="Search" image="magnifyingglass" catalog="system" id="BbH-jq-PCM"/>
|
||||
<connections>
|
||||
<outlet property="searchBar" destination="hhy-IY-MGR" id="G2a-h9-e8z"/>
|
||||
<outlet property="searchResults" destination="43I-Fg-55Z" id="chP-zW-RKH"/>
|
||||
<segue destination="qLX-b5-SkZ" kind="presentation" identifier="ShowMonsterDetail" id="kbb-pI-zWM"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user