commit 28b61ff0d09f863c8e56fe87e58fe660584deadd
parent 001fb6529dc447f6d242cda3f97b28fd77eda1ff
Author: Kyle Milz <kyle@Kyles-MacBook-Pro.local>
Date: Sat, 19 Sep 2015 15:58:27 -0600
ios: rename List{Detail,}TableViewController
Diffstat:
8 files changed, 220 insertions(+), 220 deletions(-)
diff --git a/ios-ng/shlist.xcodeproj/project.pbxproj b/ios-ng/shlist.xcodeproj/project.pbxproj
@@ -25,7 +25,7 @@
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 */; };
- BF7776B91B38928D00526CB0 /* ListDetailTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7776B81B38928D00526CB0 /* ListDetailTableViewController.m */; };
+ BF7776B91B38928D00526CB0 /* ListTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7776B81B38928D00526CB0 /* ListTableViewController.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -70,8 +70,8 @@
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>"; };
27DCC9EA1B9FF89E00207340 /* AddressBook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddressBook.m; sourceTree = "<group>"; };
- BF7776B71B38928D00526CB0 /* ListDetailTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListDetailTableViewController.h; sourceTree = "<group>"; };
- BF7776B81B38928D00526CB0 /* ListDetailTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ListDetailTableViewController.m; sourceTree = "<group>"; };
+ BF7776B71B38928D00526CB0 /* ListTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListTableViewController.h; sourceTree = "<group>"; };
+ BF7776B81B38928D00526CB0 /* ListTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ListTableViewController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -135,8 +135,8 @@
27C70F0F1B32AF8000DADEB3 /* Images.xcassets */,
27DCC9E71B9EB4E800207340 /* information15-3.png */,
27C70F111B32AF8000DADEB3 /* LaunchScreen.xib */,
- BF7776B71B38928D00526CB0 /* ListDetailTableViewController.h */,
- BF7776B81B38928D00526CB0 /* ListDetailTableViewController.m */,
+ BF7776B71B38928D00526CB0 /* ListTableViewController.h */,
+ BF7776B81B38928D00526CB0 /* ListTableViewController.m */,
27C70F0C1B32AF8000DADEB3 /* Main.storyboard */,
27C70F2E1B33F4FA00DADEB3 /* MainTableViewController.h */,
27C70F2F1B33F4FA00DADEB3 /* MainTableViewController.m */,
@@ -276,7 +276,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- BF7776B91B38928D00526CB0 /* ListDetailTableViewController.m in Sources */,
+ BF7776B91B38928D00526CB0 /* ListTableViewController.m in Sources */,
27AAC22C1B50ABAF00D99171 /* NewItemTableViewController.m in Sources */,
27C70F0B1B32AF8000DADEB3 /* ShlistServer.m in Sources */,
27D805731BA2649D00867494 /* ContactsTableViewController.m in Sources */,
diff --git a/ios-ng/shlist/Base.lproj/Main.storyboard b/ios-ng/shlist/Base.lproj/Main.storyboard
@@ -9,7 +9,7 @@
<!--List Detail-->
<scene sceneID="NFJ-ye-dsA">
<objects>
- <tableViewController title="List Detail" id="pMK-tA-j4s" customClass="ListDetailTableViewController" sceneMemberID="viewController">
+ <tableViewController title="List Detail" id="pMK-tA-j4s" customClass="ListTableViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="dCf-l7-AN3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
diff --git a/ios-ng/shlist/ListDetailTableViewController.h b/ios-ng/shlist/ListDetailTableViewController.h
@@ -1,12 +0,0 @@
-#import <UIKit/UIKit.h>
-#import "DataStructures.h"
-
-@interface ListDetailTableViewController : UITableViewController
-
-@property SharedList *list_metadata;
-@property NSMutableArray *list_items;
-- (IBAction)unwindToList:(UIStoryboardSegue *)segue;
-- (void) setMetadata:(SharedList *)metadata;
-
-
-@end
diff --git a/ios-ng/shlist/ListDetailTableViewController.m b/ios-ng/shlist/ListDetailTableViewController.m
@@ -1,197 +0,0 @@
-#import "ListDetailTableViewController.h"
-#import "DataStructures.h"
-#import "ShlistServer.h"
-
-@interface ListDetailTableViewController ()
-
-- (void)load_initial_data;
-@property (strong, nonatomic) ShlistServer *server;
-
-@end
-
-@implementation ListDetailTableViewController
-
-- (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];
-}
-
-- (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.leftBarButtonItem = self.editButtonItem;
-
- self.list_items = [[NSMutableArray alloc] init];
- [self load_initial_data];
-}
-
-- (void) didReceiveMemoryWarning
-{
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
-}
-
-- (IBAction)unwindToList:(UIStoryboardSegue *)segue {
-
-}
-
-- (void) setMetadata:(SharedList *)metadata
-{
- _list_metadata = metadata;
- self.title = _list_metadata.list_name;
-
-}
-
-#pragma mark - Table view data source
-
-- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
-{
- return 2;
-}
-
-- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
-{
- return [self.list_items count];
-}
-
-- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
-{
- if (section == 0) {
- return @"shared items";
- }
- else if (section == 1) {
- return @"personal items";
- }
- return @"";
-}
-
-- (UITableViewCell *) tableView:(UITableView *)tableView
- cellForRowAtIndexPath:(NSIndexPath *)indexPath
-{
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ListDetailPrototypeCell"
- forIndexPath:indexPath];
-
- NSUInteger section = [indexPath section];
-
- // NSLog(@"ListDetailTableViewController::cellForRowAtIndexPath()");
- // Tags:
- // 1) modifier -- ie $, info, etc
- // 2) item name
- // 3) quantity of item, in parenthesis
- // 4) owners name
- // 5) completion/packing of item
-
- UILabel *label;
- ListItem *item = [self.list_items objectAtIndex:indexPath.row];
-
- 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) {
- UIImageView *image_view;
- image_view = (UIImageView *)[cell viewWithTag:1];
- image_view.image = [UIImage imageNamed: @"information15-3.png"];
- }
-
- 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 = @"";
- }
-
- 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;
-
- label = (UILabel *)[cell viewWithTag:5];
- if (section == 0)
- ;
- else
- label.hidden = true;
-
- 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.
-}
-*/
-
-@end
-\ No newline at end of file
diff --git a/ios-ng/shlist/ListTableViewController.h b/ios-ng/shlist/ListTableViewController.h
@@ -0,0 +1,12 @@
+#import <UIKit/UIKit.h>
+#import "DataStructures.h"
+
+@interface ListTableViewController : UITableViewController
+
+@property SharedList *list_metadata;
+@property NSMutableArray *list_items;
+- (IBAction)unwindToList:(UIStoryboardSegue *)segue;
+- (void) setMetadata:(SharedList *)metadata;
+
+
+@end
diff --git a/ios-ng/shlist/ListTableViewController.m b/ios-ng/shlist/ListTableViewController.m
@@ -0,0 +1,197 @@
+#import "ListTableViewController.h"
+#import "DataStructures.h"
+#import "ShlistServer.h"
+
+@interface ListTableViewController ()
+
+- (void)load_initial_data;
+@property (strong, nonatomic) ShlistServer *server;
+
+@end
+
+@implementation ListTableViewController
+
+- (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];
+}
+
+- (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.leftBarButtonItem = self.editButtonItem;
+
+ self.list_items = [[NSMutableArray alloc] init];
+ [self load_initial_data];
+}
+
+- (void) didReceiveMemoryWarning
+{
+ [super didReceiveMemoryWarning];
+ // Dispose of any resources that can be recreated.
+}
+
+- (IBAction)unwindToList:(UIStoryboardSegue *)segue {
+
+}
+
+- (void) setMetadata:(SharedList *)metadata
+{
+ _list_metadata = metadata;
+ self.title = _list_metadata.list_name;
+
+}
+
+#pragma mark - Table view data source
+
+- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
+{
+ return 2;
+}
+
+- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+ return [self.list_items count];
+}
+
+- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
+{
+ if (section == 0) {
+ return @"shared items";
+ }
+ else if (section == 1) {
+ return @"personal items";
+ }
+ return @"";
+}
+
+- (UITableViewCell *) tableView:(UITableView *)tableView
+ cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ListDetailPrototypeCell"
+ forIndexPath:indexPath];
+
+ NSUInteger section = [indexPath section];
+
+ // NSLog(@"ListDetailTableViewController::cellForRowAtIndexPath()");
+ // Tags:
+ // 1) modifier -- ie $, info, etc
+ // 2) item name
+ // 3) quantity of item, in parenthesis
+ // 4) owners name
+ // 5) completion/packing of item
+
+ UILabel *label;
+ ListItem *item = [self.list_items objectAtIndex:indexPath.row];
+
+ 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) {
+ UIImageView *image_view;
+ image_view = (UIImageView *)[cell viewWithTag:1];
+ image_view.image = [UIImage imageNamed: @"information15-3.png"];
+ }
+
+ 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 = @"";
+ }
+
+ 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;
+
+ label = (UILabel *)[cell viewWithTag:5];
+ if (section == 0)
+ ;
+ else
+ label.hidden = true;
+
+ 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.
+}
+*/
+
+@end
+\ No newline at end of file
diff --git a/ios-ng/shlist/MainTableViewController.m b/ios-ng/shlist/MainTableViewController.m
@@ -1,7 +1,7 @@
#import "MainTableViewController.h"
#import "NewListViewController.h"
#import "ShlistServer.h"
-#import "ListDetailTableViewController.h"
+#import "ListTableViewController.h"
#import <AddressBook/AddressBook.h>
diff --git a/ios-ng/shlist/ShlistServer.h b/ios-ng/shlist/ShlistServer.h
@@ -1,6 +1,6 @@
#import <UIKit/UIKit.h>
#import "MainTableViewController.h"
-#import "ListDetailTableViewController.h"
+#import "ListTableViewController.h"
@interface ShlistServer : NSObject <NSStreamDelegate> {
NSInputStream *inputShlistStream;
@@ -9,7 +9,7 @@
@public
MainTableViewController *shlist_tvc;
- ListDetailTableViewController *shlist_ldvc;
+ ListTableViewController *shlist_ldvc;
}