aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddie Ehlin <eddiex@eddiex.se>2013-01-09 21:38:16 +0100
committerEddie Ehlin <eddiex@eddiex.se>2013-01-09 21:38:16 +0100
commitcf036b3c0509ca28505b73c4028c2b90371bf027 (patch)
tree71958dbe642bc2310ec5539f0d02eee7dc8fc9ae
parentbafbeea4d9400099c0a653cdabe6e41f7451995e (diff)
downloadiBean-cf036b3c0509ca28505b73c4028c2b90371bf027.tar.gz
iBean-cf036b3c0509ca28505b73c4028c2b90371bf027.zip
Added animated toggle editing to BeanCollectionList.
-rw-r--r--iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstatebin30346 -> 30580 bytes
-rw-r--r--iBean/iBean/BeanCollectionListViewController.h4
-rw-r--r--iBean/iBean/BeanCollectionListViewController.m12
-rw-r--r--iBean/iBean/iPhoneStoryboard.storyboard8
4 files changed, 17 insertions, 7 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 f937bb9..b147436 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/BeanCollectionListViewController.h b/iBean/iBean/BeanCollectionListViewController.h
index 5ac810d..648216b 100644
--- a/iBean/iBean/BeanCollectionListViewController.h
+++ b/iBean/iBean/BeanCollectionListViewController.h
@@ -12,14 +12,16 @@
@property (nonatomic, strong) NSArray *beanCollections;
@property (nonatomic, strong) BeanCollection *beanCollection;
+@property (nonatomic, strong) UIBarButtonItem *beanCollectionsListEditDoneButton;
/* Utility methods */
- (void) initViewController;
/* UI Outlets */
+@property (strong, nonatomic) IBOutlet UIBarButtonItem *beanCollectionsListEditButton;
/* UI Actions */
-- (IBAction) editButtonPressed: (id)sender;
+- (IBAction) toggleEditMode: (id)sender;
@end
diff --git a/iBean/iBean/BeanCollectionListViewController.m b/iBean/iBean/BeanCollectionListViewController.m
index c7adf33..4432fe5 100644
--- a/iBean/iBean/BeanCollectionListViewController.m
+++ b/iBean/iBean/BeanCollectionListViewController.m
@@ -169,6 +169,9 @@
{
NSLog(@"BeanCollectionListViewController - initViewController");
+ //Allocate edit's done button
+ self.beanCollectionsListEditDoneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(toggleEditMode:)];
+
//Remove "new" bean collection if it is allocated
if (self.beanCollection != nil)
{
@@ -192,13 +195,14 @@
*****************************************************/
#pragma mark - IBActions
-- (void) editButtonPressed: (id)sender
+- (void) toggleEditMode:(id)sender
{
if (self.editing)
- NSLog(@"Disabling editing mode!");
+ self.navigationItem.leftBarButtonItem = self.beanCollectionsListEditButton;
else
- NSLog(@"Enabling editing mode!");
- self.editing = !self.editing;
+ self.navigationItem.leftBarButtonItem = self.beanCollectionsListEditDoneButton;
+
+ [self setEditing:!self.editing animated:YES];
}
@end
diff --git a/iBean/iBean/iPhoneStoryboard.storyboard b/iBean/iBean/iPhoneStoryboard.storyboard
index c9fd722..5fc65b8 100644
--- a/iBean/iBean/iPhoneStoryboard.storyboard
+++ b/iBean/iBean/iPhoneStoryboard.storyboard
@@ -39,7 +39,7 @@
<navigationItem key="navigationItem" title="iBean" id="kps-mZ-pxP">
<barButtonItem key="leftBarButtonItem" systemItem="edit" id="lNm-m6-tWK">
<connections>
- <action selector="editButtonPressed:" destination="agK-tm-pZO" id="V8U-4t-IMx"/>
+ <action selector="toggleEditMode:" destination="agK-tm-pZO" id="lfY-BG-5iE"/>
</connections>
</barButtonItem>
<barButtonItem key="rightBarButtonItem" systemItem="add" id="Wuc-np-Bjz">
@@ -48,6 +48,9 @@
</connections>
</barButtonItem>
</navigationItem>
+ <connections>
+ <outlet property="beanCollectionsListEditButton" destination="lNm-m6-tWK" id="BWn-Ra-QyB"/>
+ </connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="BXw-pd-TpS" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
@@ -490,7 +493,8 @@
<class className="BeanCollectionListViewController" superclassName="UITableViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/BeanCollectionListViewController.h"/>
<relationships>
- <relationship kind="action" name="editButtonPressed:"/>
+ <relationship kind="action" name="toggleEditMode:"/>
+ <relationship kind="outlet" name="beanCollectionsListEditButton" candidateClass="UIBarButtonItem"/>
</relationships>
</class>
<class className="InstaBeanViewController" superclassName="UIViewController">