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
32 changes: 26 additions & 6 deletions OptionSelector.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
objects = {

/* Begin PBXBuildFile section */
69A20AF51B7D507D00FE4D0D /* CQCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 69A20AF41B7D507D00FE4D0D /* CQCategory.m */; };
69A20AF81B7D516100FE4D0D /* CQTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 69A20AF71B7D516100FE4D0D /* CQTableViewController.m */; };
69A20B2B1B7EBD8200FE4D0D /* CQmodel.m in Sources */ = {isa = PBXBuildFile; fileRef = 69A20B2A1B7EBD8200FE4D0D /* CQmodel.m */; };
69A20B341B7EC51D00FE4D0D /* CQOptionsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 69A20B331B7EC51D00FE4D0D /* CQOptionsTableViewController.m */; };
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 */; };
Expand All @@ -27,13 +30,19 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
69A20AF31B7D507D00FE4D0D /* CQCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CQCategory.h; sourceTree = "<group>"; };
69A20AF41B7D507D00FE4D0D /* CQCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CQCategory.m; sourceTree = "<group>"; };
69A20AF61B7D516100FE4D0D /* CQTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CQTableViewController.h; sourceTree = "<group>"; };
69A20AF71B7D516100FE4D0D /* CQTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CQTableViewController.m; sourceTree = "<group>"; };
69A20B291B7EBD8200FE4D0D /* CQmodel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CQmodel.h; sourceTree = "<group>"; };
69A20B2A1B7EBD8200FE4D0D /* CQmodel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CQmodel.m; sourceTree = "<group>"; };
69A20B321B7EC51D00FE4D0D /* CQOptionsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CQOptionsTableViewController.h; sourceTree = "<group>"; };
69A20B331B7EC51D00FE4D0D /* CQOptionsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CQOptionsTableViewController.m; sourceTree = "<group>"; };
8DECE78C1B78082B0064D760 /* OptionSelector.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OptionSelector.app; sourceTree = BUILT_PRODUCTS_DIR; };
8DECE7901B78082B0064D760 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
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>"; };
Expand Down Expand Up @@ -83,8 +92,14 @@
children = (
8DECE7931B78082B0064D760 /* AppDelegate.h */,
8DECE7941B78082B0064D760 /* AppDelegate.m */,
8DECE7961B78082B0064D760 /* ViewController.h */,
8DECE7971B78082B0064D760 /* ViewController.m */,
69A20AF31B7D507D00FE4D0D /* CQCategory.h */,
69A20AF41B7D507D00FE4D0D /* CQCategory.m */,
69A20B291B7EBD8200FE4D0D /* CQmodel.h */,
69A20B2A1B7EBD8200FE4D0D /* CQmodel.m */,
69A20AF61B7D516100FE4D0D /* CQTableViewController.h */,
69A20AF71B7D516100FE4D0D /* CQTableViewController.m */,
69A20B321B7EC51D00FE4D0D /* CQOptionsTableViewController.h */,
69A20B331B7EC51D00FE4D0D /* CQOptionsTableViewController.m */,
8DECE7991B78082B0064D760 /* Main.storyboard */,
8DECE79C1B78082B0064D760 /* Images.xcassets */,
8DECE79E1B78082B0064D760 /* LaunchScreen.xib */,
Expand Down Expand Up @@ -219,9 +234,12 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8DECE7981B78082B0064D760 /* ViewController.m in Sources */,
69A20B341B7EC51D00FE4D0D /* CQOptionsTableViewController.m in Sources */,
69A20AF51B7D507D00FE4D0D /* CQCategory.m in Sources */,
69A20AF81B7D516100FE4D0D /* CQTableViewController.m in Sources */,
8DECE7951B78082B0064D760 /* AppDelegate.m in Sources */,
8DECE7921B78082B0064D760 /* main.m in Sources */,
69A20B2B1B7EBD8200FE4D0D /* CQmodel.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -418,6 +436,7 @@
8DECE7B11B78082B0064D760 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8DECE7B21B78082B0064D760 /* Build configuration list for PBXNativeTarget "OptionSelectorTests" */ = {
isa = XCConfigurationList;
Expand All @@ -426,6 +445,7 @@
8DECE7B41B78082B0064D760 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
85 changes: 70 additions & 15 deletions OptionSelector/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,25 +1,80 @@
<?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="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="9A8-b9-Y4e">
<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="gTz-gK-CyN">
<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="74y-uc-civ" customClass="CQTableViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="aCw-yL-MPX">
<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="CategoriesIdentifier" id="1iM-y9-q2n">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="1iM-y9-q2n" id="42v-nv-l6J">
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
<connections>
<segue destination="wvk-OJ-W2x" kind="show" id="iAE-4v-5hF"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="74y-uc-civ" id="mLE-eV-Dc4"/>
<outlet property="delegate" destination="74y-uc-civ" id="wr9-MH-FTq"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Root View Controller" id="HQ3-Wz-COz"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="MT9-FG-3al" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="642" y="324"/>
</scene>
<!--Options Table View Controller-->
<scene sceneID="pT7-Cc-Aft">
<objects>
<tableViewController id="wvk-OJ-W2x" customClass="CQOptionsTableViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="PL3-US-4Jm">
<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="gDv-AL-jce">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="gDv-AL-jce" id="UH7-dU-FsF">
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="wvk-OJ-W2x" id="BmS-cR-isP"/>
<outlet property="delegate" destination="wvk-OJ-W2x" id="vUM-AV-qsk"/>
</connections>
</tableView>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="czw-px-ldR" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1343" y="324"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="R1E-q8-OB6">
<objects>
<navigationController id="9A8-b9-Y4e" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="Eid-6i-KS0">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="74y-uc-civ" kind="relationship" relationship="rootViewController" id="uxG-ag-zOI"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="EoX-eX-LFO" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-178" y="324"/>
</scene>
</scenes>
</document>
17 changes: 17 additions & 0 deletions OptionSelector/CQCategory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// CQCategory.h
// OptionSelector
//
// Created by Z on 8/13/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface CQCategory : NSObject

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good practice to include at least one comment for each class describing what it does or what data it stores (if it's just a data storage class). Even if it seems obvious to you now, it might not in a month (and it might not to your colleagues).


@property (nonatomic) NSString *name;
@property (nonatomic) NSArray *options;
@property (nonatomic) NSString *selection;

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

#import "CQCategory.h"

@implementation CQCategory

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

#import <UIKit/UIKit.h>
#import "CQCategory.h"
#import "CQTableViewController.h"

@interface CQOptionsTableViewController : UITableViewController

@property (nonatomic) CQCategory *category;

@property (nonatomic,retain) NSIndexPath *checkedIndexPath;

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

#import "CQOptionsTableViewController.h"

@interface CQOptionsTableViewController ()

@end

@implementation CQOptionsTableViewController

- (void)viewDidLoad {
[super viewDidLoad];

// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;

// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.category.options.count;
}

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

// Configure the cell...
cell.textLabel.text = [self.category.options objectAtIndex:indexPath.row];

if([self.checkedIndexPath isEqual:indexPath])
{
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
else
{
cell.accessoryType = UITableViewCellAccessoryNone;
}

return cell;
}

#pragma mark - row selection

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

// Uncheck the previous checked row
if(self.checkedIndexPath)
{
UITableViewCell* uncheckCell = [tableView
cellForRowAtIndexPath:self.checkedIndexPath];
uncheckCell.accessoryType = UITableViewCellAccessoryNone;
}
UITableViewCell* cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryType = UITableViewCellAccessoryCheckmark;
self.checkedIndexPath = indexPath;

self.category.selection = cell.textLabel.text;
}


#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.

CQTableViewController *tableVC = segue.destinationViewController;

//unfinished method

}


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

#import <UIKit/UIKit.h>
#import "CQCategory.h"
#import "CQmodel.h"
#import "CQOptionsTableViewController.h"

@interface CQTableViewController : UITableViewController

@property (nonatomic) NSArray *categories;

@end
Loading