aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstatebin30432 -> 30411 bytes
-rw-r--r--iBean/iBean/BeanCollectionBeanListViewController.h3
-rw-r--r--iBean/iBean/BeanCollectionBeanListViewController.m53
-rw-r--r--iBean/iBean/iPhoneStoryboard.storyboard12
4 files changed, 66 insertions, 2 deletions
diff --git a/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate b/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate
index 0fe9ebe..4948f3e 100644
--- a/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate
+++ b/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate
Binary files differ
diff --git a/iBean/iBean/BeanCollectionBeanListViewController.h b/iBean/iBean/BeanCollectionBeanListViewController.h
index 2441a48..5865904 100644
--- a/iBean/iBean/BeanCollectionBeanListViewController.h
+++ b/iBean/iBean/BeanCollectionBeanListViewController.h
@@ -9,7 +9,7 @@
#import <UIKit/UIKit.h>
@class BeanCollection;
-@interface BeanCollectionBeanListViewController : UIViewController
+@interface BeanCollectionBeanListViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) BeanCollection *beanCollection;
@property (nonatomic, assign) BOOL editMode;
@@ -19,6 +19,7 @@
- (void) initWithModeAndBeanCollection:(BOOL)editMode: (BeanCollection*) bc;
/* UI Outlets */
+@property (weak, nonatomic) IBOutlet UITableView *beanListTableView;
/* UI Actions */
diff --git a/iBean/iBean/BeanCollectionBeanListViewController.m b/iBean/iBean/BeanCollectionBeanListViewController.m
index 8bc5085..4564776 100644
--- a/iBean/iBean/BeanCollectionBeanListViewController.m
+++ b/iBean/iBean/BeanCollectionBeanListViewController.m
@@ -52,6 +52,9 @@
{
NSLog(@"BeanCollectionBeanListViewController - initViewController");
+ //Load beans into the table view.
+ //[self.beanListTableView reloadData];
+
if (self.editMode == YES)
{
//TODO: Update UI to refelect edit mode.
@@ -70,6 +73,7 @@
NSLog(@"BeanCollectionBeanListViewController - initWithModeAndBeanCollection");
self.editMode = editMode;
self.beanCollection = bc;
+
}
/*****************************************************
@@ -77,4 +81,53 @@
*****************************************************/
#pragma mark - IBActions
+/*****************************************************
+ UITableView related delegate / datasource methods
+ *****************************************************/
+#pragma mark - UITableViewDelegate methods
+
+- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
+{
+ return 1;
+}
+
+- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+ return self.beanCollection.beans.count;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ static NSString *CellIdentifier = @"BeanCell";
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
+
+ //Configure the cell and set its title
+#warning TODO: This may fuck things up since the beanCollection.beans set is NOT ordered?
+ BeanCollection *currentCollection = [[self.beanCollection.beans allObjects] objectAtIndex:indexPath.row];
+ cell.textLabel.text = currentCollection.name;
+
+ 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 (we want to be able to REMOVE though).
+ 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
+#warning TODO - Implement this (look at CollectionList....)
+ [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
+ }
+}
+
+
@end
diff --git a/iBean/iBean/iPhoneStoryboard.storyboard b/iBean/iBean/iPhoneStoryboard.storyboard
index ce404ed..2f5d54b 100644
--- a/iBean/iBean/iPhoneStoryboard.storyboard
+++ b/iBean/iBean/iPhoneStoryboard.storyboard
@@ -287,6 +287,10 @@
</view>
</tableViewCell>
</prototypes>
+ <connections>
+ <outlet property="dataSource" destination="utP-dF-IAb" id="Gye-ZC-wtY"/>
+ <outlet property="delegate" destination="utP-dF-IAb" id="xQi-Ma-c2U"/>
+ </connections>
</tableView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
@@ -306,6 +310,9 @@
</connections>
</barButtonItem>
</navigationItem>
+ <connections>
+ <outlet property="beanListTableView" destination="bW3-E7-UoQ" id="ZGo-IU-3Im"/>
+ </connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="BhV-Dk-tNN" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
@@ -444,6 +451,9 @@
<classes>
<class className="BeanCollectionBeanListViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/BeanCollectionBeanListViewController.h"/>
+ <relationships>
+ <relationship kind="outlet" name="beanListTableView" candidateClass="UITableView"/>
+ </relationships>
</class>
<class className="BeanCollectionInfoViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/BeanCollectionInfoViewController.h"/>
@@ -481,6 +491,6 @@
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
<inferredMetricsTieBreakers>
- <segue reference="9nO-3G-dWz"/>
+ <segue reference="ndw-lE-35x"/>
</inferredMetricsTieBreakers>
</document> \ No newline at end of file