commit b5e684bd4504f5fb005b58bd2e46455d2afafa19
parent 4933a5c5a621b3fda815f91eccea3047cb3716fc
Author: Kyle Milz <kyle@Kyles-MacBook-Pro.local>
Date: Tue, 22 Sep 2015 00:12:08 -0600
ios: polish gui, get an edit line class going
Diffstat:
10 files changed, 491 insertions(+), 206 deletions(-)
diff --git a/ios-ng/NewItemTableViewController.m b/ios-ng/NewItemTableViewController.m
@@ -2,6 +2,11 @@
@interface NewItemTableViewController ()
+
+@property (weak, nonatomic) IBOutlet UILabel *item_name;
+@property (weak, nonatomic) IBOutlet UISwitch *purchase_switch;
+@property (weak, nonatomic) IBOutlet UISwitch *shared_sw;
+
@end
@implementation NewItemTableViewController
@@ -9,8 +14,15 @@
// called when shared switch is toggled
- (IBAction)shared_switch:(id)sender
{
+ NSIndexSet *index_set = [NSIndexSet indexSetWithIndex:1];
+
+ if ([self.tableView numberOfSections] == 1)
+ [self.tableView insertSections:index_set withRowAnimation:UITableViewRowAnimationMiddle];
+ else
+ [self.tableView deleteSections:index_set withRowAnimation:UITableViewRowAnimationMiddle];
+
// hide/unhide the shared status group
- [self.tableView reloadData];
+ // [self.tableView reloadData];
}
- (void)viewDidLoad {
@@ -28,30 +40,27 @@
// Dispose of any resources that can be recreated.
}
-#pragma mark - Table view data source
-
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// get the shared switch state to see if the shared properties should
// be shown
- NSIndexPath *index_path = [NSIndexPath indexPathForRow:1 inSection:0];
+ // NSIndexPath *index_path = [NSIndexPath indexPathForRow:1 inSection:0];
- UITableViewCell *cell = [super tableView:tableView
- cellForRowAtIndexPath:index_path];
+ // UITableViewCell *cell = [super tableView:tableView
+ // cellForRowAtIndexPath:index_path];
+
+ // UISwitch *shared_switch = (UISwitch *)[cell viewWithTag:1];
- UISwitch *shared_switch = (UISwitch *)[cell viewWithTag:1];
- if (shared_switch.isOn) {
+ if (_shared_sw.isOn)
return 2;
- } else {
+ else
return 1;
- }
}
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
-
// NSLog(@"info: reloading rows in table view");
if (section == 0)
diff --git a/ios-ng/shlist.xcodeproj/project.pbxproj b/ios-ng/shlist.xcodeproj/project.pbxproj
@@ -20,6 +20,7 @@
27C70F2D1B33F3C300DADEB3 /* NewListTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 27C70F2C1B33F3C300DADEB3 /* NewListTableViewController.m */; };
27C70F301B33F4FA00DADEB3 /* MainTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 27C70F2F1B33F4FA00DADEB3 /* MainTableViewController.m */; };
27D805731BA2649D00867494 /* ContactsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 27D805721BA2649D00867494 /* ContactsTableViewController.m */; };
+ 27D83D2A1BAFC99D0029F54B /* EditTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 27D83D291BAFC99D0029F54B /* EditTableViewController.m */; };
27DCC9DE1B8A98D400207340 /* dollar103-2.png in Resources */ = {isa = PBXBuildFile; fileRef = 27DCC9DD1B8A98D400207340 /* dollar103-2.png */; };
27DCC9E81B9EB4E800207340 /* information15-3.png in Resources */ = {isa = PBXBuildFile; fileRef = 27DCC9E71B9EB4E800207340 /* information15-3.png */; };
27DCC9EB1B9FF89E00207340 /* AddressBook.m in Sources */ = {isa = PBXBuildFile; fileRef = 27DCC9EA1B9FF89E00207340 /* AddressBook.m */; };
@@ -61,6 +62,8 @@
27C70F2F1B33F4FA00DADEB3 /* MainTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainTableViewController.m; sourceTree = "<group>"; };
27D805711BA2649D00867494 /* ContactsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactsTableViewController.h; sourceTree = SOURCE_ROOT; };
27D805721BA2649D00867494 /* ContactsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactsTableViewController.m; sourceTree = SOURCE_ROOT; };
+ 27D83D281BAFC99D0029F54B /* EditTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditTableViewController.h; sourceTree = "<group>"; };
+ 27D83D291BAFC99D0029F54B /* EditTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EditTableViewController.m; sourceTree = "<group>"; };
27DCC9DD1B8A98D400207340 /* dollar103-2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "dollar103-2.png"; path = "../../../Downloads/dollar103-2.png"; sourceTree = "<group>"; };
27DCC9E71B9EB4E800207340 /* information15-3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "information15-3.png"; path = "../../../Downloads/information15-3.png"; sourceTree = "<group>"; };
27DCC9E91B9FF89E00207340 /* AddressBook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddressBook.h; sourceTree = "<group>"; };
@@ -125,6 +128,8 @@
BF7776B71B38928D00526CB0 /* ListTableViewController.h */,
BF7776B81B38928D00526CB0 /* ListTableViewController.m */,
27C70F0C1B32AF8000DADEB3 /* Main.storyboard */,
+ 27D83D281BAFC99D0029F54B /* EditTableViewController.h */,
+ 27D83D291BAFC99D0029F54B /* EditTableViewController.m */,
27C70F2E1B33F4FA00DADEB3 /* MainTableViewController.h */,
27C70F2F1B33F4FA00DADEB3 /* MainTableViewController.m */,
27C70F091B32AF8000DADEB3 /* Network.h */,
@@ -277,6 +282,7 @@
27DCC9EB1B9FF89E00207340 /* AddressBook.m in Sources */,
27C70F301B33F4FA00DADEB3 /* MainTableViewController.m in Sources */,
27C70F051B32AF8000DADEB3 /* main.m in Sources */,
+ 27D83D2A1BAFC99D0029F54B /* EditTableViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/ios-ng/shlist/Base.lproj/Main.storyboard b/ios-ng/shlist/Base.lproj/Main.storyboard
@@ -15,56 +15,46 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
- <tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="ListDetailPrototypeCell" id="s1K-8G-gXq">
+ <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="ListDetailPrototypeCell" id="s1K-8G-gXq">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="s1K-8G-gXq" id="H4s-wq-8Lq">
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <imageView userInteractionEnabled="NO" tag="1" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="zsB-mz-ffa">
- <rect key="frame" x="8" y="14" width="16" height="16"/>
- <constraints>
- <constraint firstAttribute="height" constant="16" id="F2X-d2-ZlF"/>
- <constraint firstAttribute="width" constant="16" id="yLY-Mg-1wi"/>
- </constraints>
- </imageView>
<label opaque="NO" userInteractionEnabled="NO" tag="2" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Name" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="btC-Lf-VTy">
- <rect key="frame" x="32" y="11" width="46" height="21"/>
+ <rect key="frame" x="16" y="11" width="46" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" tag="5" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="n1B-AB-bme">
- <rect key="frame" x="510" y="6" width="51" height="31"/>
+ <rect key="frame" x="535" y="6" width="51" height="31"/>
</switch>
<label opaque="NO" userInteractionEnabled="NO" tag="4" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Owner" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0TP-dF-f2P">
- <rect key="frame" x="451" y="11" width="51" height="21"/>
+ <rect key="frame" x="476" y="11" width="51" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
- <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" tag="3" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Quantity" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="upb-uA-yH2">
- <rect key="frame" x="86" y="13" width="55" height="17"/>
+ <rect key="frame" x="70" y="13" width="55" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
- <constraint firstItem="upb-uA-yH2" firstAttribute="leading" secondItem="btC-Lf-VTy" secondAttribute="trailing" constant="8" id="7TQ-hg-IXK"/>
+ <constraint firstItem="btC-Lf-VTy" firstAttribute="leading" secondItem="H4s-wq-8Lq" secondAttribute="leadingMargin" constant="8" id="5to-9N-ciC"/>
<constraint firstItem="upb-uA-yH2" firstAttribute="leading" secondItem="btC-Lf-VTy" secondAttribute="trailing" constant="8" id="7aj-Mf-7or"/>
- <constraint firstAttribute="centerY" secondItem="zsB-mz-ffa" secondAttribute="centerY" id="Kke-yQ-lIU"/>
- <constraint firstItem="btC-Lf-VTy" firstAttribute="leading" secondItem="zsB-mz-ffa" secondAttribute="trailing" constant="8" id="M46-uZ-0Zj"/>
<constraint firstAttribute="centerY" secondItem="upb-uA-yH2" secondAttribute="centerY" id="MWW-iY-71k"/>
- <constraint firstItem="n1B-AB-bme" firstAttribute="trailing" secondItem="H4s-wq-8Lq" secondAttribute="trailingMargin" id="VG7-8h-1wm"/>
+ <constraint firstItem="n1B-AB-bme" firstAttribute="trailing" secondItem="H4s-wq-8Lq" secondAttribute="trailingMargin" constant="-8" id="VG7-8h-1wm"/>
<constraint firstAttribute="centerY" secondItem="btC-Lf-VTy" secondAttribute="centerY" id="Yg4-lg-cMN"/>
<constraint firstAttribute="centerY" secondItem="0TP-dF-f2P" secondAttribute="centerY" id="chu-HH-HQT"/>
<constraint firstAttribute="centerY" secondItem="n1B-AB-bme" secondAttribute="centerY" id="cyz-Nv-ZRW"/>
- <constraint firstItem="zsB-mz-ffa" firstAttribute="leading" secondItem="H4s-wq-8Lq" secondAttribute="leadingMargin" id="pRr-Zl-ahy"/>
<constraint firstItem="n1B-AB-bme" firstAttribute="leading" secondItem="0TP-dF-f2P" secondAttribute="trailing" constant="8" id="rYF-Sw-Bsg"/>
</constraints>
</tableViewCellContentView>
<connections>
- <segue destination="8Gi-Gc-mRg" kind="show" id="u9Y-bO-Pfj"/>
+ <segue destination="KAJ-Ph-mEk" kind="presentation" id="Z5g-ao-bLA"/>
</connections>
</tableViewCell>
</prototypes>
@@ -121,55 +111,55 @@
</constraints>
</tableViewCellContentView>
</tableViewCell>
- <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="40G-4d-KXw">
+ <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="EtU-pb-OGN">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
- <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="40G-4d-KXw" id="xcB-Zu-7Yt">
+ <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="EtU-pb-OGN" id="rFW-W4-rEL">
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Shared" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MsQ-Iq-XOk">
- <rect key="frame" x="8" y="11" width="55" height="21"/>
+ <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="ZG9-yz-YFh">
+ <rect key="frame" x="543" y="6" width="51" height="31"/>
+ </switch>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Purchase" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Uxj-my-Z2Y">
+ <rect key="frame" x="8" y="11" width="72" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
- <switch opaque="NO" tag="1" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xy3-L7-YrZ">
- <rect key="frame" x="543" y="6" width="51" height="31"/>
- <connections>
- <action selector="shared_switch:" destination="8Gi-Gc-mRg" eventType="valueChanged" id="Add-PE-NRp"/>
- </connections>
- </switch>
</subviews>
<constraints>
- <constraint firstItem="xy3-L7-YrZ" firstAttribute="trailing" secondItem="xcB-Zu-7Yt" secondAttribute="trailingMargin" id="JoL-Hq-y2d"/>
- <constraint firstAttribute="centerY" secondItem="xy3-L7-YrZ" secondAttribute="centerY" id="yuO-MF-KCL"/>
+ <constraint firstAttribute="centerY" secondItem="ZG9-yz-YFh" secondAttribute="centerY" id="80p-g3-bEH"/>
+ <constraint firstItem="ZG9-yz-YFh" firstAttribute="trailing" secondItem="rFW-W4-rEL" secondAttribute="trailingMargin" id="vZc-93-inJ"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
- <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="EtU-pb-OGN">
- <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="40G-4d-KXw">
<autoresizingMask key="autoresizingMask"/>
- <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="EtU-pb-OGN" id="rFW-W4-rEL">
+ <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="40G-4d-KXw" id="xcB-Zu-7Yt">
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="ZG9-yz-YFh">
- <rect key="frame" x="543" y="6" width="51" height="31"/>
- </switch>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Needs purchase" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Uxj-my-Z2Y">
- <rect key="frame" x="8" y="11" width="126" height="21"/>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Shared" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MsQ-Iq-XOk">
+ <rect key="frame" x="8" y="11" width="55" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
+ <switch opaque="NO" tag="1" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="xy3-L7-YrZ">
+ <rect key="frame" x="543" y="6" width="51" height="31"/>
+ <connections>
+ <action selector="shared_switch:" destination="8Gi-Gc-mRg" eventType="valueChanged" id="Add-PE-NRp"/>
+ </connections>
+ </switch>
</subviews>
<constraints>
- <constraint firstAttribute="centerY" secondItem="ZG9-yz-YFh" secondAttribute="centerY" id="80p-g3-bEH"/>
- <constraint firstItem="ZG9-yz-YFh" firstAttribute="trailing" secondItem="rFW-W4-rEL" secondAttribute="trailingMargin" id="vZc-93-inJ"/>
+ <constraint firstItem="xy3-L7-YrZ" firstAttribute="trailing" secondItem="xcB-Zu-7Yt" secondAttribute="trailingMargin" id="JoL-Hq-y2d"/>
+ <constraint firstAttribute="centerY" secondItem="xy3-L7-YrZ" secondAttribute="centerY" id="yuO-MF-KCL"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
- <tableViewSection headerTitle="Shared Status" id="Lg0-Eo-t0T">
+ <tableViewSection headerTitle="Status" id="Lg0-Eo-t0T">
<cells>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="CLf-ge-Fs1">
<autoresizingMask key="autoresizingMask"/>
@@ -239,11 +229,16 @@
</connections>
</barButtonItem>
</navigationItem>
+ <connections>
+ <outlet property="item_name" destination="RxZ-xc-Qog" id="nxl-In-G7u"/>
+ <outlet property="purchase_switch" destination="ZG9-yz-YFh" id="5ir-Mo-Mkl"/>
+ <outlet property="shared_sw" destination="xy3-L7-YrZ" id="lDX-FU-p1a"/>
+ </connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="HuD-ay-3nZ" userLabel="First Responder" sceneMemberID="firstResponder"/>
<exit id="lUt-lN-Y7n" userLabel="Exit" sceneMemberID="exit"/>
</objects>
- <point key="canvasLocation" x="3128" y="-638"/>
+ <point key="canvasLocation" x="3828" y="-638"/>
</scene>
<!--Shlist-->
<scene sceneID="hc1-Lv-WtP">
@@ -321,7 +316,7 @@
</objects>
<point key="canvasLocation" x="432" y="202"/>
</scene>
- <!--New List-->
+ <!--Add Shared List-->
<scene sceneID="tne-QT-ifu">
<objects>
<tableViewController id="BYZ-38-t0r" customClass="NewListTableViewController" sceneMemberID="viewController">
@@ -351,52 +346,58 @@
</label>
</subviews>
</tableViewCellContentView>
+ <connections>
+ <segue destination="uyw-yd-pcJ" kind="show" id="HBi-RJ-djr"/>
+ </connections>
</tableViewCell>
- <tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="n3s-JI-Clc">
+ <tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" id="Eio-uC-eIV">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
- <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="n3s-JI-Clc" id="8WY-QD-XTP">
+ <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Eio-uC-eIV" id="GxB-ho-h09">
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ne1-ps-7is">
- <rect key="frame" x="535" y="6" width="51" height="31"/>
- </switch>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Deadline" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pGX-Of-yrM">
- <rect key="frame" x="16" y="11" width="67" height="21"/>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Filter" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3TM-pU-nxd">
+ <rect key="frame" x="16" y="11" width="38" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
- <constraint firstItem="pGX-Of-yrM" firstAttribute="leading" secondItem="8WY-QD-XTP" secondAttribute="leadingMargin" constant="8" id="QAo-yD-uXp"/>
- <constraint firstItem="ne1-ps-7is" firstAttribute="trailing" secondItem="8WY-QD-XTP" secondAttribute="trailingMargin" constant="-8" id="XAd-gl-4EU"/>
- <constraint firstAttribute="centerY" secondItem="ne1-ps-7is" secondAttribute="centerY" id="czl-Xy-rNE"/>
- <constraint firstAttribute="centerY" secondItem="pGX-Of-yrM" secondAttribute="centerY" id="j1X-2j-nE0"/>
+ <constraint firstItem="3TM-pU-nxd" firstAttribute="leading" secondItem="GxB-ho-h09" secondAttribute="leadingMargin" constant="8" id="ADi-VP-AOO"/>
+ <constraint firstAttribute="centerY" secondItem="3TM-pU-nxd" secondAttribute="centerY" id="xqK-IK-0Gd"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
- <tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" id="Eio-uC-eIV">
- <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="n3s-JI-Clc">
<autoresizingMask key="autoresizingMask"/>
- <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Eio-uC-eIV" id="GxB-ho-h09">
+ <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="n3s-JI-Clc" id="8WY-QD-XTP">
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Filter" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3TM-pU-nxd">
- <rect key="frame" x="16" y="11" width="38" height="21"/>
+ <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="ne1-ps-7is">
+ <rect key="frame" x="535" y="6" width="51" height="31"/>
+ <connections>
+ <action selector="deadline_toggle:" destination="BYZ-38-t0r" eventType="valueChanged" id="4UX-zI-fYZ"/>
+ </connections>
+ </switch>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Deadline" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pGX-Of-yrM">
+ <rect key="frame" x="16" y="11" width="67" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
- <constraint firstItem="3TM-pU-nxd" firstAttribute="leading" secondItem="GxB-ho-h09" secondAttribute="leadingMargin" constant="8" id="ADi-VP-AOO"/>
- <constraint firstAttribute="centerY" secondItem="3TM-pU-nxd" secondAttribute="centerY" id="xqK-IK-0Gd"/>
+ <constraint firstItem="pGX-Of-yrM" firstAttribute="leading" secondItem="8WY-QD-XTP" secondAttribute="leadingMargin" constant="8" id="QAo-yD-uXp"/>
+ <constraint firstItem="ne1-ps-7is" firstAttribute="trailing" secondItem="8WY-QD-XTP" secondAttribute="trailingMargin" constant="-8" id="XAd-gl-4EU"/>
+ <constraint firstAttribute="centerY" secondItem="ne1-ps-7is" secondAttribute="centerY" id="czl-Xy-rNE"/>
+ <constraint firstAttribute="centerY" secondItem="pGX-Of-yrM" secondAttribute="centerY" id="j1X-2j-nE0"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
- <tableViewSection headerTitle="Pick Deadline" id="ZYQ-vQ-gWY">
+ <tableViewSection headerTitle="Deadline" id="ZYQ-vQ-gWY">
<cells>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="KEP-cd-Ehh">
<autoresizingMask key="autoresizingMask"/>
@@ -422,7 +423,7 @@
</tableViewSection>
</sections>
</tableView>
- <navigationItem key="navigationItem" title="New List" id="5ys-ck-wLj">
+ <navigationItem key="navigationItem" title="Add Shared List" id="5ys-ck-wLj">
<barButtonItem key="leftBarButtonItem" systemItem="cancel" id="WaR-Ud-Hmo">
<connections>
<segue destination="C3w-Ab-gX6" kind="unwind" unwindAction="unwindToList:" id="7wZ-HT-2Br"/>
@@ -435,13 +436,63 @@
</barButtonItem>
</navigationItem>
<connections>
+ <outlet property="deadline_switch" destination="ne1-ps-7is" id="0ZO-6x-AKb"/>
+ <outlet property="list_name" destination="tFs-mH-vtj" id="fBo-Fk-fGt"/>
<outlet property="saveButton" destination="gBs-i9-WN3" id="MOy-AZ-jOX"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
<exit id="C3w-Ab-gX6" userLabel="Exit" sceneMemberID="exit"/>
</objects>
- <point key="canvasLocation" x="2316" y="202"/>
+ <point key="canvasLocation" x="2168" y="202"/>
+ </scene>
+ <!--Edit Name-->
+ <scene sceneID="zfF-AW-NC3">
+ <objects>
+ <tableViewController id="uyw-yd-pcJ" customClass="EditTableViewController" sceneMemberID="viewController">
+ <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="MTf-9J-cV9">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
+ <sections>
+ <tableViewSection id="C5K-4r-fcJ">
+ <cells>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="Fh0-AS-3Xz">
+ <autoresizingMask key="autoresizingMask"/>
+ <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Fh0-AS-3Xz" id="rdS-MC-CIV">
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <textField opaque="NO" clipsSubviews="YES" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="zf2-sM-1jM">
+ <rect key="frame" x="16" y="13" width="576" height="17"/>
+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <textInputTraits key="textInputTraits"/>
+ </textField>
+ </subviews>
+ <constraints>
+ <constraint firstAttribute="centerY" secondItem="zf2-sM-1jM" secondAttribute="centerY" id="ITS-ER-UMZ"/>
+ <constraint firstItem="zf2-sM-1jM" firstAttribute="leading" secondItem="rdS-MC-CIV" secondAttribute="leadingMargin" constant="8" id="Iz2-Fw-nSC"/>
+ <constraint firstAttribute="trailingMargin" secondItem="zf2-sM-1jM" secondAttribute="trailing" id="fxK-sZ-D6d"/>
+ </constraints>
+ </tableViewCellContentView>
+ </tableViewCell>
+ </cells>
+ </tableViewSection>
+ </sections>
+ <connections>
+ <outlet property="dataSource" destination="uyw-yd-pcJ" id="YrX-2W-obM"/>
+ <outlet property="delegate" destination="uyw-yd-pcJ" id="8Wd-dS-vES"/>
+ </connections>
+ </tableView>
+ <navigationItem key="navigationItem" title="Edit Name" id="fd1-sm-vtP"/>
+ <connections>
+ <outlet property="list_name" destination="zf2-sM-1jM" id="w6j-kT-Mxt"/>
+ <segue destination="w7g-ds-BFe" kind="unwind" unwindAction="unwindToAddList:" id="Gsp-mJ-yJ9"/>
+ </connections>
+ </tableViewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="K6g-mo-23k" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ <exit id="w7g-ds-BFe" userLabel="Exit" sceneMemberID="exit"/>
+ </objects>
+ <point key="canvasLocation" x="3024" y="202"/>
</scene>
<!--Tab Bar Controller-->
<scene sceneID="TmM-gX-MFR">
@@ -560,7 +611,7 @@
</subviews>
</tableViewCellContentView>
<connections>
- <segue destination="2wR-ox-ygu" kind="show" id="nZh-So-yMA"/>
+ <segue destination="eOn-mZ-1W0" kind="showDetail" id="NXM-5v-RjK"/>
</connections>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="0kV-we-bvq" detailTextLabel="hcO-PG-uAA" style="IBUITableViewCellStyleValue1" id="pLe-rJ-ITY">
@@ -597,48 +648,6 @@
</objects>
<point key="canvasLocation" x="432" y="2022"/>
</scene>
- <!--Edit Line Table View Controller-->
- <scene sceneID="2u4-qw-YzR">
- <objects>
- <tableViewController id="2wR-ox-ygu" userLabel="Edit Line Table View Controller" sceneMemberID="viewController">
- <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="wHL-jK-gRV">
- <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
- <sections>
- <tableViewSection id="ebc-84-rdp">
- <cells>
- <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="Czg-pt-9Mt">
- <autoresizingMask key="autoresizingMask"/>
- <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Czg-pt-9Mt" id="f3R-s3-9jK">
- <autoresizingMask key="autoresizingMask"/>
- <subviews>
- <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="oqT-NG-UTN">
- <rect key="frame" x="16" y="13" width="568" height="17"/>
- <fontDescription key="fontDescription" type="system" pointSize="14"/>
- <textInputTraits key="textInputTraits"/>
- </textField>
- </subviews>
- <constraints>
- <constraint firstAttribute="centerY" secondItem="oqT-NG-UTN" secondAttribute="centerY" id="7Ve-1d-Cpw"/>
- <constraint firstItem="oqT-NG-UTN" firstAttribute="leading" secondItem="f3R-s3-9jK" secondAttribute="leadingMargin" constant="8" id="eSu-Yc-MqZ"/>
- <constraint firstAttribute="trailingMargin" secondItem="oqT-NG-UTN" secondAttribute="trailing" constant="8" id="lbw-eK-c0a"/>
- </constraints>
- </tableViewCellContentView>
- </tableViewCell>
- </cells>
- </tableViewSection>
- </sections>
- <connections>
- <outlet property="dataSource" destination="2wR-ox-ygu" id="bUa-Cn-Q2o"/>
- <outlet property="delegate" destination="2wR-ox-ygu" id="1xC-c0-Wev"/>
- </connections>
- </tableView>
- </tableViewController>
- <placeholder placeholderIdentifier="IBFirstResponder" id="Ysr-vN-7Hy" userLabel="First Responder" sceneMemberID="firstResponder"/>
- </objects>
- <point key="canvasLocation" x="1261" y="2019"/>
- </scene>
<!--Shared Lists-->
<scene sceneID="vP4-SE-UGa">
<objects>
@@ -692,7 +701,7 @@
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="AR0-99-D0J" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
- <point key="canvasLocation" x="2316" y="-1518"/>
+ <point key="canvasLocation" x="3016" y="-638"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="9uD-bo-9f6">
@@ -750,8 +759,54 @@
</objects>
<point key="canvasLocation" x="1356" y="-628"/>
</scene>
+ <!--Phone Number-->
+ <scene sceneID="WHb-Pn-jJ3">
+ <objects>
+ <tableViewController id="eOn-mZ-1W0" customClass="EditTableViewController" sceneMemberID="viewController">
+ <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="06k-PX-b3B">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
+ <sections>
+ <tableViewSection id="uPa-bA-uam">
+ <cells>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="uQa-7g-srm">
+ <autoresizingMask key="autoresizingMask"/>
+ <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="uQa-7g-srm" id="AHt-vU-iUs">
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <textField opaque="NO" clipsSubviews="YES" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="rIo-B6-tNi">
+ <rect key="frame" x="16" y="13" width="576" height="17"/>
+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <textInputTraits key="textInputTraits"/>
+ </textField>
+ </subviews>
+ <constraints>
+ <constraint firstAttribute="trailingMargin" secondItem="rIo-B6-tNi" secondAttribute="trailing" id="fHU-X9-ldM"/>
+ <constraint firstItem="rIo-B6-tNi" firstAttribute="leading" secondItem="AHt-vU-iUs" secondAttribute="leadingMargin" constant="8" id="nmZ-WF-jkz"/>
+ <constraint firstAttribute="centerY" secondItem="rIo-B6-tNi" secondAttribute="centerY" id="qAg-Cz-WiC"/>
+ </constraints>
+ </tableViewCellContentView>
+ </tableViewCell>
+ </cells>
+ </tableViewSection>
+ </sections>
+ <connections>
+ <outlet property="dataSource" destination="eOn-mZ-1W0" id="b6l-Cw-pXP"/>
+ <outlet property="delegate" destination="eOn-mZ-1W0" id="YGd-Df-sUQ"/>
+ </connections>
+ </tableView>
+ <navigationItem key="navigationItem" title="Phone Number" id="Tn4-wu-Cat"/>
+ <connections>
+ <outlet property="list_name" destination="rIo-B6-tNi" id="GX6-5f-7hZ"/>
+ </connections>
+ </tableViewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="PuT-ts-rjK" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="1235" y="2022"/>
+ </scene>
</scenes>
<inferredMetricsTieBreakers>
- <segue reference="u9Y-bO-Pfj"/>
+ <segue reference="jZG-FG-nAX"/>
</inferredMetricsTieBreakers>
</document>
diff --git a/ios-ng/shlist/DataStructures.h b/ios-ng/shlist/DataStructures.h
@@ -25,6 +25,7 @@
@property NSString *name;
@property int quantity;
@property NSString *owner;
+@property bool committed;
@property int completed;
@end
\ No newline at end of file
diff --git a/ios-ng/shlist/EditTableViewController.h b/ios-ng/shlist/EditTableViewController.h
@@ -0,0 +1,7 @@
+#import <UIKit/UIKit.h>
+
+@interface EditTableViewController : UITableViewController
+
+@property (weak, nonatomic) IBOutlet UITextField *list_name;
+
+@end
+\ No newline at end of file
diff --git a/ios-ng/shlist/EditTableViewController.m b/ios-ng/shlist/EditTableViewController.m
@@ -0,0 +1,101 @@
+#import "EditTableViewController.h"
+
+@interface EditTableViewController ()
+
+@end
+
+@implementation EditTableViewController
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ [self.list_name becomeFirstResponder];
+}
+
+
+- (void)didReceiveMemoryWarning {
+ [super didReceiveMemoryWarning];
+ // Dispose of any resources that can be recreated.
+}
+
+#pragma mark - Table view data source
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+ // Return the number of sections.
+ return 1;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ // Return the number of rows in the section.
+ return 1;
+}
+
+/*
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath];
+
+ // Configure the cell...
+
+ return cell;
+}
+*/
+
+/*
+// Override to support conditional editing of the table view.
+- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
+ // Return NO if you do not want the specified item to be editable.
+ return YES;
+}
+*/
+
+/*
+// Override to support editing the table view.
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
+ if (editingStyle == UITableViewCellEditingStyleDelete) {
+ // Delete the row from the data source
+ [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
+ } else if (editingStyle == UITableViewCellEditingStyleInsert) {
+ // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
+ }
+}
+*/
+
+/*
+// Override to support rearranging the table view.
+- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
+}
+*/
+
+/*
+// Override to support conditional rearranging of the table view.
+- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
+ // Return NO if you do not want the item to be re-orderable.
+ return YES;
+}
+*/
+
+#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.
+
+ // Get the new view controller using [segue destinationViewController].
+ // Pass the selected object to the new view controller.
+
+ // if (sender != self.saveButton) return;
+
+ // if (self.list_name.text.length > 0) {
+ // self.shared_list = [[SharedList alloc] init];
+ // self.shared_list.name = self.textField.text;
+ // self.shared_list.list_date = self.datePicker.date;
+ // self.shared_list.members = @"You";
+
+ NSLog(@"finished editing line '%@'", self.list_name.text);
+ // }
+
+
+}
+
+@end
diff --git a/ios-ng/shlist/ListTableViewController.h b/ios-ng/shlist/ListTableViewController.h
@@ -4,7 +4,10 @@
@interface ListTableViewController : UITableViewController
@property SharedList *list_metadata;
+
@property NSMutableArray *list_items;
+@property NSMutableArray *private_items;
+
- (IBAction)unwindToList:(UIStoryboardSegue *)segue;
- (void) setMetadata:(SharedList *)metadata;
diff --git a/ios-ng/shlist/ListTableViewController.m b/ios-ng/shlist/ListTableViewController.m
@@ -13,31 +13,79 @@
- (void) load_initial_data
{
- // NSLog(@"ListDetailTableViewController::load_initial_data()");
-
- ListItem *item1 = [[ListItem alloc] init];
- item1.modifier = 1;
- item1.name = @"cheese";
- item1.quantity = 3;
- item1.owner = @"Kyle";
- item1.completed = 0;
- [self.list_items addObject:item1];
-
- ListItem *item2 = [[ListItem alloc] init];
- item2.modifier = 0;
- item2.name = @"camp stove";
- item2.quantity = 1;
- item2.owner = @"";
- item2.completed = 1;
- [self.list_items addObject:item2];
-
- ListItem *item3 = [[ListItem alloc] init];
- item3.modifier = 2;
- item3.name = @"ear plugs";
- item3.quantity = 1;
- item3.owner = @"";
- item3.completed = 0;
- [self.list_items addObject:item3];
+ ListItem *item = [[ListItem alloc] init];
+ item.name = @"Cheese Pizza";
+ item.owner = @"Dave";
+ item.committed = 1;
+ [self.list_items addObject:item];
+
+ item = [[ListItem alloc] init];
+ item.modifier = 0;
+ item.name = @"Camp stove";
+ item.owner = @"Steve";
+ item.committed = 1;
+ [self.list_items addObject:item];
+
+ item = [[ListItem alloc] init];
+ item.name = @"Ear Plugs";
+ item.quantity = 10;
+ item.owner = @"";
+ item.committed = 0;
+ [self.list_items addObject:item];
+
+ item = [[ListItem alloc] init];
+ item.name = @"Fruit by the Foot";
+ item.quantity = 1;
+ item.owner = @"You";
+ item.committed = 1;
+ [self.list_items addObject:item];
+
+ item = [[ListItem alloc] init];
+ item.name = @"Well used matress";
+ item.quantity = 1;
+ item.owner = @"";
+ item.committed = 0;
+ [self.list_items addObject:item];
+
+ item = [[ListItem alloc] init];
+ item.name = @"Rifle and Ammo";
+ item.quantity = 1;
+ item.owner = @"Greg";
+ item.committed = 1;
+ [self.list_items addObject:item];
+
+
+ item = [[ListItem alloc] init];
+ item.name = @"Deoderant";
+ [self.private_items addObject:item];
+
+ item = [[ListItem alloc] init];
+ item.name = @"Toothbrush";
+ [self.private_items addObject:item];
+
+ item = [[ListItem alloc] init];
+ item.name = @"Pillow";
+ [self.private_items addObject:item];
+
+ item = [[ListItem alloc] init];
+ item.name = @"Brass knuckles";
+ [self.private_items addObject:item];
+
+ item = [[ListItem alloc] init];
+ item.name = @"Soldering Iron";
+ [self.private_items addObject:item];
+
+ item = [[ListItem alloc] init];
+ item.name = @"8mm wrench";
+ [self.private_items addObject:item];
+
+ item = [[ListItem alloc] init];
+ item.name = @"Fuzzy Dice";
+ [self.private_items addObject:item];
+
+ item = [[ListItem alloc] init];
+ item.name = @"Jerry Can";
+ [self.private_items addObject:item];
}
- (void) viewDidLoad
@@ -52,7 +100,8 @@
// navigation bar for this view controller.
// self.navigationItem.leftBarButtonItem = self.editButtonItem;
- self.list_items = [[NSMutableArray alloc] init];
+ _list_items = [[NSMutableArray alloc] init];
+ _private_items = [[NSMutableArray alloc] init];
[self load_initial_data];
}
@@ -70,7 +119,6 @@
{
_list_metadata = metadata;
self.title = _list_metadata.name;
-
}
#pragma mark - Table view data source
@@ -82,17 +130,19 @@
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
- return [self.list_items count];
+ if (section == 0)
+ return [_list_items count];
+ else if (section == 1)
+ return [_private_items count];
+ return 0;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
- if (section == 0) {
- return @"shared items";
- }
- else if (section == 1) {
- return @"personal items";
- }
+ if (section == 0)
+ return [NSString stringWithFormat:@"Shared Items (%i)", [_list_items count]];
+ else if (section == 1)
+ return [NSString stringWithFormat:@"Private Items (%i)", [_private_items count]];
return @"";
}
@@ -102,9 +152,6 @@
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ListDetailPrototypeCell"
forIndexPath:indexPath];
- NSUInteger section = [indexPath section];
-
- // NSLog(@"ListDetailTableViewController::cellForRowAtIndexPath()");
// Tags:
// 1) modifier -- ie $, info, etc
// 2) item name
@@ -112,42 +159,56 @@
// 4) owners name
// 5) completion/packing of item
- UILabel *label;
- ListItem *item = [self.list_items objectAtIndex:indexPath.row];
+ UILabel *item_name = (UILabel *)[cell viewWithTag:2];
+ UILabel *quantity = (UILabel *)[cell viewWithTag:3];
+ UILabel *owner = (UILabel *)[cell viewWithTag:4];
+ UISwitch *commit_switch = (UISwitch *)[cell viewWithTag:5];
+ /*
if (item.modifier == 1) {
UIImageView *image_view;
image_view = (UIImageView *)[cell viewWithTag:1];
image_view.image = [UIImage imageNamed: @"dollar103-2.png"];
- }
- else if (item.modifier == 2) {
+ }
+ else if (item.modifier == 2) {
UIImageView *image_view;
image_view = (UIImageView *)[cell viewWithTag:1];
image_view.image = [UIImage imageNamed: @"information15-3.png"];
+ }
+ */
+
+ ListItem *item;
+ if ([indexPath section] == 0) {
+ // "shared items" section
+ item = [self.list_items objectAtIndex:indexPath.row];
+
+ owner.text = @"";
+ [commit_switch setOn:item.committed animated:YES];
+
+ if (item.committed) {
+ if ([item.owner compare:@"You"] == NSOrderedSame)
+ owner.text = @"";
+ else {
+ owner.text = item.owner;
+ [commit_switch setEnabled:NO];
+ }
+ }
}
+ else if ([indexPath section] == 1) {
+ // "private items" section
+ item = [self.private_items objectAtIndex:indexPath.row];
- label = (UILabel *)[cell viewWithTag:2];
- label.text = item.name;
-
- label = (UILabel *)[cell viewWithTag:3];
- if (item.quantity > 1) {
- label.text = [NSString stringWithFormat:@"(x%d)", item.quantity];
- } else {
- label.text = @"";
+ // no owner or commit fields here
+ owner.hidden = true;
+ commit_switch.hidden = true;
}
- label = (UILabel *)[cell viewWithTag:4];
- if (section == 0)
- // XXX: this should go to N/A when item doesn't have an owner
- label.text = item.owner;
- else
- label.hidden = true;
+ item_name.text = item.name;
- label = (UILabel *)[cell viewWithTag:5];
- if (section == 0)
- ;
+ if (item.quantity > 1)
+ quantity.text = [NSString stringWithFormat:@"(x%d)", item.quantity];
else
- label.hidden = true;
+ quantity.hidden = true;
return cell;
}
diff --git a/ios-ng/shlist/MainTableViewController.m b/ios-ng/shlist/MainTableViewController.m
@@ -140,8 +140,6 @@ clickedButtonAtIndex:(NSInteger)buttonIndex
// Dispose of any resources that can be recreated.
}
-#pragma mark - Table view data source
-
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
{
// "lists you're in" and "other lists"
@@ -274,16 +272,14 @@ clickedButtonAtIndex:(NSInteger)buttonIndex
int row = [indexPath row];
SharedList *shared_list;
- UILabel *main_label = (UILabel *)[cell viewWithTag:1];
- UILabel *members_label = (UILabel *)[cell viewWithTag:2];
UILabel *deadline_label = (UILabel *)[cell viewWithTag:3];
UILabel *fraction_label = (UILabel *)[cell viewWithTag:4];
if ([indexPath section] == 0) {
+ // "lists you're in" section
shared_list = [self.shared_lists objectAtIndex:row];
- main_label.text = shared_list.name;
- members_label.text = [self process_members_array:shared_list.members_phone_nums];
+ // XXX: needs to be stored on/sent from the server
deadline_label.text = @"in 3 days";
// set color based on how complete the list is
@@ -303,22 +299,24 @@ clickedButtonAtIndex:(NSInteger)buttonIndex
denominator:shared_list.items_total];
}
else if ([indexPath section] == 1) {
+ // "other lists" section
shared_list = [self.indirect_lists objectAtIndex:row];
- main_label.text = shared_list.name;
- members_label.text = [self process_members_array:shared_list.members_phone_nums];
- deadline_label.text = @"";
- shared_list.cell = cell;
- // Modify the look of the off the shelf cell
- // Note, a separate prototype cell isn't used here because we
- // can potentially swap cells a large number of times, and moving
- // is more efficient than recreating.
+ // no deadline
+ deadline_label.text = @"";
// remove the > accessory and the completion fraction
cell.accessoryType = UITableViewCellAccessoryNone;
fraction_label.hidden = YES;
}
+ UILabel *main_label = (UILabel *)[cell viewWithTag:1];
+ UILabel *members_label = (UILabel *)[cell viewWithTag:2];
+
+ // show name and members
+ main_label.text = shared_list.name;
+ members_label.text = [self process_members_array:shared_list.members_phone_nums];
+
// hang on to a reference, this is needed in the networking gui callbacks
shared_list.cell = cell;
return cell;
@@ -381,9 +379,9 @@ clickedButtonAtIndex:(NSInteger)buttonIndex
titleForHeaderInSection:(NSInteger)section
{
if (section == 0)
- return @"Lists you're in";
+ return [NSString stringWithFormat:@"Lists you're in (%i)", [_shared_lists count]];
else if (section == 1)
- return @"Other lists";
+ return [NSString stringWithFormat:@"Other lists (%i)", [_indirect_lists count]];
return @"";
}
@@ -418,6 +416,7 @@ clickedButtonAtIndex:(NSInteger)buttonIndex
[network_connection send_message:5 contents:list.id];
}
+// customize deletion label text
- (NSString *)tableView:(UITableView *)tableView
titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
diff --git a/ios-ng/shlist/NewListTableViewController.m b/ios-ng/shlist/NewListTableViewController.m
@@ -1,19 +1,44 @@
#import "NewListTableViewController.h"
+#import "EditTableViewController.h"
-@interface NewListTableViewController ()
+@interface NewListTableViewController () {
+ int num_sections;
+}
+
+@property (weak, nonatomic) IBOutlet UIBarButtonItem *saveButton;
+@property (weak, nonatomic) IBOutlet UISwitch *deadline_switch;
+@property (weak, nonatomic) IBOutlet UILabel *list_name;
-@property (weak, nonatomic) IBOutlet UIBarButtonItem *saveButton;
-@property (weak, nonatomic) IBOutlet UITextField *textField;
-@property (weak, nonatomic) IBOutlet UIDatePicker *datePicker;
+@property (weak, nonatomic) IBOutlet UITextField *textField;
+@property (weak, nonatomic) IBOutlet UIDatePicker *datePicker;
@end
@implementation NewListTableViewController
+- (IBAction)deadline_toggle:(id)sender {
+
+ // UISwitch *dl_switch = (UISwitch *)sender;
+ NSIndexSet *index_set = [NSIndexSet indexSetWithIndex:1];
+
+ if ([self.tableView numberOfSections] == 1)
+ [self.tableView insertSections:index_set withRowAnimation:UITableViewRowAnimationMiddle];
+ else
+ [self.tableView deleteSections:index_set withRowAnimation:UITableViewRowAnimationMiddle];
+}
+
+- (IBAction) unwindToAddList:(UIStoryboardSegue *)segue
+{
+ NSLog(@"unwound");
+}
- (void) viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
+
+ _list_name.text = @"New List";
+
+ num_sections = 1;
}
- (void) didReceiveMemoryWarning {
@@ -21,24 +46,41 @@
// Dispose of any resources that can be recreated.
}
+- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
+{
+ if (_deadline_switch.isOn) {
+ return 2;
+ } else {
+ return 1;
+ }
+ // default with deadline turned off
+ return num_sections;
+}
+
#pragma mark - Navigation
// 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 ([[segue identifier] isEqualToString:@"edit name segue"]) {
+ NSLog(@"info: new list: edit name segue");
+
+ // EditTableViewController *edit = [segue destinationViewController];
+ // edit.list_name.text = @"New List";
+ return;
+ }
- if (sender != self.saveButton) return;
+ if (sender != self.saveButton)
+ return;
- if (self.textField.text.length > 0) {
+ // if (self.textField.text.length > 0) {
self.shared_list = [[SharedList alloc] init];
- self.shared_list.name = self.textField.text;
+ self.shared_list.name = self.list_name.text;
// self.shared_list.list_date = self.datePicker.date;
// self.shared_list.members = @"You";
NSLog(@"NewListViewController::prepareForSegue(): %@", self.textField.text);
- }
+ // }
}
@end
\ No newline at end of file