From cf036b3c0509ca28505b73c4028c2b90371bf027 Mon Sep 17 00:00:00 2001 From: Eddie Ehlin Date: Wed, 9 Jan 2013 21:38:16 +0100 Subject: Added animated toggle editing to BeanCollectionList. --- .../UserInterfaceState.xcuserstate | Bin 30346 -> 30580 bytes iBean/iBean/BeanCollectionListViewController.h | 4 +++- iBean/iBean/BeanCollectionListViewController.m | 12 ++++++++---- iBean/iBean/iPhoneStoryboard.storyboard | 8 ++++++-- 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 Binary files a/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate and b/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate 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 @@ - + @@ -48,6 +48,9 @@ + + + @@ -490,7 +493,8 @@ - + + -- cgit v1.2.3