Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions OptionSelector.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
/* Begin PBXBuildFile section */
8DECE7921B78082B0064D760 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DECE7911B78082B0064D760 /* main.m */; };
8DECE7951B78082B0064D760 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DECE7941B78082B0064D760 /* AppDelegate.m */; };
8DECE7981B78082B0064D760 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DECE7971B78082B0064D760 /* ViewController.m */; };
8DECE79B1B78082B0064D760 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DECE7991B78082B0064D760 /* Main.storyboard */; };
8DECE79D1B78082B0064D760 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8DECE79C1B78082B0064D760 /* Images.xcassets */; };
8DECE7A01B78082B0064D760 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8DECE79E1B78082B0064D760 /* LaunchScreen.xib */; };
8DECE7AC1B78082B0064D760 /* OptionSelectorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DECE7AB1B78082B0064D760 /* OptionSelectorTests.m */; };
C7827DCC1B7D5D0A0024690F /* Option.m in Sources */ = {isa = PBXBuildFile; fileRef = C7827DCB1B7D5D0A0024690F /* Option.m */; };
C7D9FECE1B79057C0055D0D4 /* OSTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C7D9FECD1B79057C0055D0D4 /* OSTableViewController.m */; };
C7D9FED11B790A310055D0D4 /* OSDetailTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C7D9FED01B790A310055D0D4 /* OSDetailTableViewController.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -32,14 +34,19 @@
8DECE7911B78082B0064D760 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
8DECE7931B78082B0064D760 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
8DECE7941B78082B0064D760 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
8DECE7961B78082B0064D760 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
8DECE7971B78082B0064D760 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
8DECE79A1B78082B0064D760 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
8DECE79C1B78082B0064D760 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
8DECE79F1B78082B0064D760 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
8DECE7A51B78082B0064D760 /* OptionSelectorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OptionSelectorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
8DECE7AA1B78082B0064D760 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8DECE7AB1B78082B0064D760 /* OptionSelectorTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OptionSelectorTests.m; sourceTree = "<group>"; };
C7827DCA1B7D5D0A0024690F /* Option.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Option.h; sourceTree = "<group>"; };
C7827DCB1B7D5D0A0024690F /* Option.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Option.m; sourceTree = "<group>"; };
C7D9FECC1B79057C0055D0D4 /* OSTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSTableViewController.h; sourceTree = "<group>"; };
C7D9FECD1B79057C0055D0D4 /* OSTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OSTableViewController.m; sourceTree = "<group>"; };
C7D9FECF1B790A310055D0D4 /* OSDetailTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSDetailTableViewController.h; sourceTree = "<group>"; };
C7D9FED01B790A310055D0D4 /* OSDetailTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OSDetailTableViewController.m; sourceTree = "<group>"; };
C7D9FED21B790A5A0055D0D4 /* OSDetailTableViewControllerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSDetailTableViewControllerDelegate.h; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -81,10 +88,15 @@
8DECE78E1B78082B0064D760 /* OptionSelector */ = {
isa = PBXGroup;
children = (
C7D9FECC1B79057C0055D0D4 /* OSTableViewController.h */,
C7D9FECD1B79057C0055D0D4 /* OSTableViewController.m */,
C7D9FECF1B790A310055D0D4 /* OSDetailTableViewController.h */,
C7D9FED01B790A310055D0D4 /* OSDetailTableViewController.m */,
C7D9FED21B790A5A0055D0D4 /* OSDetailTableViewControllerDelegate.h */,
C7827DCA1B7D5D0A0024690F /* Option.h */,
C7827DCB1B7D5D0A0024690F /* Option.m */,
8DECE7931B78082B0064D760 /* AppDelegate.h */,
8DECE7941B78082B0064D760 /* AppDelegate.m */,
8DECE7961B78082B0064D760 /* ViewController.h */,
8DECE7971B78082B0064D760 /* ViewController.m */,
8DECE7991B78082B0064D760 /* Main.storyboard */,
8DECE79C1B78082B0064D760 /* Images.xcassets */,
8DECE79E1B78082B0064D760 /* LaunchScreen.xib */,
Expand Down Expand Up @@ -219,7 +231,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8DECE7981B78082B0064D760 /* ViewController.m in Sources */,
C7D9FED11B790A310055D0D4 /* OSDetailTableViewController.m in Sources */,
C7D9FECE1B79057C0055D0D4 /* OSTableViewController.m in Sources */,
C7827DCC1B7D5D0A0024690F /* Option.m in Sources */,
8DECE7951B78082B0064D760 /* AppDelegate.m in Sources */,
8DECE7921B78082B0064D760 /* main.m in Sources */,
);
Expand Down Expand Up @@ -378,6 +392,7 @@
"$(inherited)",
);
INFOPLIST_FILE = OptionSelectorTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OptionSelector.app/OptionSelector";
Expand All @@ -393,6 +408,7 @@
"$(inherited)",
);
INFOPLIST_FILE = OptionSelectorTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OptionSelector.app/OptionSelector";
Expand All @@ -418,6 +434,7 @@
8DECE7B11B78082B0064D760 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8DECE7B21B78082B0064D760 /* Build configuration list for PBXNativeTarget "OptionSelectorTests" */ = {
isa = XCConfigurationList;
Expand All @@ -426,6 +443,7 @@
8DECE7B41B78082B0064D760 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
105 changes: 90 additions & 15 deletions OptionSelector/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,25 +1,100 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="LFP-Xw-oQO">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="ufC-wZ-h7g">
<!--Root View Controller-->
<scene sceneID="Rgm-0C-kmR">
<objects>
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<tableViewController id="Pdb-89-6RB" customClass="OSTableViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="qu8-Vf-IIx">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="OptionSelectorIdentifier" textLabel="Ez8-uv-5WM" detailTextLabel="8XQ-Au-exL" style="IBUITableViewCellStyleValue1" id="byA-YF-Epz">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="byA-YF-Epz" id="kqh-c1-7ZI">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Ez8-uv-5WM">
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="8XQ-Au-exL">
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="RVG-Zm-QS7" kind="show" id="XxM-cQ-M9Q"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="Pdb-89-6RB" id="QHm-jZ-HZD"/>
<outlet property="delegate" destination="Pdb-89-6RB" id="THQ-Hj-zvq"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Root View Controller" id="TcI-Nd-9Iu">
<barButtonItem key="rightBarButtonItem" systemItem="save" id="dHC-el-lfh">
<connections>
<action selector="saveData:" destination="Pdb-89-6RB" id="Hp2-Ew-dli"/>
</connections>
</barButtonItem>
</navigationItem>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="NUj-Dt-Ws9" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="789" y="220"/>
</scene>
<!--Detail Table View Controller-->
<scene sceneID="fqd-kX-qFh">
<objects>
<tableViewController id="RVG-Zm-QS7" customClass="OSDetailTableViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="2DL-Gg-bxM">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="OptionsIdentifier" id="HKF-r9-URV">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="HKF-r9-URV" id="Tjr-7s-d1h">
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="RVG-Zm-QS7" id="zGC-7g-wVr"/>
<outlet property="delegate" destination="RVG-Zm-QS7" id="qXB-ll-JEH"/>
</connections>
</tableView>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="fAU-B8-ZqK" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1484" y="258"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="v4O-mB-pRJ">
<objects>
<navigationController id="LFP-Xw-oQO" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="2Vz-53-UX5">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="Pdb-89-6RB" kind="relationship" relationship="rootViewController" id="XNP-PP-bKn"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="YnD-81-gKy" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-31" y="220"/>
</scene>
</scenes>
</document>
18 changes: 18 additions & 0 deletions OptionSelector/OSDetailTableViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// OSDetailTableViewController.h
// OptionSelector
//
// Created by Varindra Hart on 8/10/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "OSDetailTableViewControllerDelegate.h"
#import "Option.h"

@interface OSDetailTableViewController : UITableViewController

@property (nonatomic,weak) id<OSDetailTableViewControllerDelegate>delegate;
@property (nonatomic) Option *selectedCategory;

@end
79 changes: 79 additions & 0 deletions OptionSelector/OSDetailTableViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//
// OSDetailTableViewController.m
// OptionSelector
//
// Created by Varindra Hart on 8/10/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
//

#import "OSDetailTableViewController.h"
#import "Option.h"

@interface OSDetailTableViewController ()

@property (nonatomic) NSDictionary *dictionaryOfOptionsForKey;

@end

@implementation OSDetailTableViewController

- (void)viewDidLoad {
[super viewDidLoad];


}


- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
#warning Potentially incomplete method implementation.
// Return the number of sections.
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete method implementation.
// Return the number of rows in the section.
return [self.selectedCategory.arrayOfOptions count];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"OptionsIdentifier" forIndexPath:indexPath];


NSArray *optionsArray = self.selectedCategory.arrayOfOptions;
cell.textLabel.text = optionsArray[indexPath.row];
cell.accessoryType = UITableViewCellAccessoryNone;
if([optionsArray[indexPath.row] isEqualToString:self.selectedCategory.selection]){
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}

return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

NSString *currentSelection = self.selectedCategory.arrayOfOptions [indexPath.row];
self.selectedCategory.selection = currentSelection;
[self.tableView reloadData];
[self.delegate tableView:self updatedSelection:self.selectedCategory];

}


#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 {
//
//}


@end
18 changes: 18 additions & 0 deletions OptionSelector/OSDetailTableViewControllerDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// OSDetailTableViewControllerDelegate.h
// OptionSelector
//
// Created by Varindra Hart on 8/10/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Option.h"

@class OSDetailTableViewController;

@protocol OSDetailTableViewControllerDelegate <NSObject>

-(void) tableView:(OSDetailTableViewController *)sender updatedSelection:(Option *)selection;

@end
Loading