From 5e2ffc80c350c95bba2fd166e85c987f97bb71ea Mon Sep 17 00:00:00 2001 From: Kyle Fang Date: Wed, 27 Feb 2013 01:21:27 +0800 Subject: [PATCH] Init pullView and Drag View --- Podfile | 1 + Progress/PPRemindersViewController.m | 85 +++++---------------------- Progress/en.lproj/Progress.storyboard | 35 +++++++---- 3 files changed, 38 insertions(+), 83 deletions(-) diff --git a/Podfile b/Podfile index 03816ba..91c1b49 100644 --- a/Podfile +++ b/Podfile @@ -6,6 +6,7 @@ platform :ios, '6.0' pod 'AHAlertView', '~>0.0.2' pod 'GVUserDefaults', '~>0.9.0' pod 'SVProgressHUD', '~>0.9' + pod 'ZGPullDragScrollView', '~>0.0.1' target :ProgressTests, :exclusive => true do pod 'GVUserDefaults', '~>0.9.0' diff --git a/Progress/PPRemindersViewController.m b/Progress/PPRemindersViewController.m index b9c53a9..b4084b2 100644 --- a/Progress/PPRemindersViewController.m +++ b/Progress/PPRemindersViewController.m @@ -9,9 +9,13 @@ #import "PPRemindersViewController.h" #import "PPEvenKitManager.h" #import +#import +#import +#import #import "ReminderItemCell.h" -@interface PPRemindersViewController () +@interface PPRemindersViewController () +@property (strong, nonatomic) IBOutlet UIView *pullDownView; @property (nonatomic) NSArray *remindersDatasource; @end @@ -19,15 +23,6 @@ static NSString *CellIdentifier = @"ReminderCell"; -- (id)initWithStyle:(UITableViewStyle)style -{ - self = [super initWithStyle:style]; - if (self) { - // Custom initialization - } - return self; -} - - (void)viewDidLoad { [super viewDidLoad]; @@ -43,6 +38,16 @@ static NSString *CellIdentifier = @"ReminderCell"; self.remindersDatasource = reminedrItems; [SVProgressHUD dismiss]; [self.tableView reloadData]; + + UIView *pullView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.tableView.rowHeight)]; + pullView.backgroundColor = [UIColor greenColor]; + [self.tableView addZGPullView:pullView]; + + UIView *dragView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.tableView.rowHeight)]; + dragView.backgroundColor = [UIColor greenColor]; + [self.tableView addZGDragView:dragView]; + self.tableView.pullDragDelegate = self; + }]; } @@ -80,14 +85,6 @@ static NSString *CellIdentifier = @"ReminderCell"; return cell; } -//- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ -// return [[UIView alloc] init]; -//} -// -//- (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ -// return 1; -//} - - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ return [[UIView alloc] init]; } @@ -96,58 +93,6 @@ static NSString *CellIdentifier = @"ReminderCell"; return 1; } -/* -// 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 - Table view delegate - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - // Navigation logic may go here. Create and push another view controller. - /* - <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil]; - // ... - // Pass the selected object to the new view controller. - [self.navigationController pushViewController:detailViewController animated:YES]; - */ -} - #pragma mark - ReminderCell Delegate - (void)completedByTheUser:(ReminderItemCell *)sender{ diff --git a/Progress/en.lproj/Progress.storyboard b/Progress/en.lproj/Progress.storyboard index 9563655..26cdaf4 100644 --- a/Progress/en.lproj/Progress.storyboard +++ b/Progress/en.lproj/Progress.storyboard @@ -43,10 +43,30 @@ + + + + + + + + + + + + + + + + + + + + - + @@ -84,20 +104,9 @@ - + - - - - - - - - - - -