Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Getting this baby ready for primetime!

  • Loading branch information...
commit d576ae579d627886b1cbc70d15db0e1fbed822d0 1 parent 6582206
@jakemarsh authored
Showing with 1,130 additions and 591 deletions.
  1. BIN  .DS_Store
  2. +14 −6 JMStatefulTableViewController.podspec
  3. +13 −12 {JMStatefulTableViewControllerDemo → JMStatefulTableViewController}/JMStatefulTableViewController.h
  4. +36 −113 {JMStatefulTableViewControllerDemo → JMStatefulTableViewController}/JMStatefulTableViewController.m
  5. +2 −2 {JMStatefulTableViewControllerDemo → JMStatefulTableViewController}/JMStatefulTableViewEmptyView.h
  6. +1 −10 {JMStatefulTableViewControllerDemo → JMStatefulTableViewController}/JMStatefulTableViewEmptyView.m
  7. +13 −0 JMStatefulTableViewController/JMStatefulTableViewErrorView.h
  8. +22 −0 JMStatefulTableViewController/JMStatefulTableViewErrorView.m
  9. +1 −1  {JMStatefulTableViewControllerDemo → JMStatefulTableViewController}/JMStatefulTableViewLoadingView.h
  10. +2 −11 {JMStatefulTableViewControllerDemo → JMStatefulTableViewController}/JMStatefulTableViewLoadingView.m
  11. +40 −24 JMStatefulTableViewControllerDemo.xcodeproj/project.pbxproj
  12. BIN  JMStatefulTableViewControllerDemo/.DS_Store
  13. +2 −2 JMStatefulTableViewControllerDemo/{JMAppDelegate.h → AppDelegate.h}
  14. +4 −10 JMStatefulTableViewControllerDemo/{JMAppDelegate.m → AppDelegate.m}
  15. +1 −1  JMStatefulTableViewControllerDemo/DemoTableViewController.h
  16. +32 −27 JMStatefulTableViewControllerDemo/DemoTableViewController.m
  17. +3 −3 JMStatefulTableViewControllerDemo/main.m
  18. +20 −0 MIT-LICENSE
  19. +1 −2  Podfile
  20. +1 −1  Podfile.lock
  21. +13 −0 Pods/Pods-Acknowledgements.markdown
  22. +43 −0 Pods/Pods-Acknowledgements.plist
  23. +8 −5 Pods/Pods-resources.sh
  24. +3 −3 Pods/Pods.xcconfig
  25. +251 −235 Pods/Pods.xcodeproj/project.pbxproj
  26. +4 −0 Pods/PodsDummy_Pods.m
  27. +0 −20 Pods/SVPullToRefresh/.gitignore
  28. +72 −7 Pods/SVPullToRefresh/README.textile
  29. BIN  Pods/SVPullToRefresh/SVPullToRefresh/SVPullToRefresh.bundle/arrow.png
  30. BIN  Pods/SVPullToRefresh/SVPullToRefresh/SVPullToRefresh.bundle/arrow@2x.png
  31. +9 −0 Pods/SVPullToRefresh/SVPullToRefresh/SVPullToRefresh.h
  32. +363 −94 Pods/SVPullToRefresh/SVPullToRefresh/SVPullToRefresh.m
  33. +156 −2 README.md
View
BIN  .DS_Store
Binary file not shown
View
20 JMStatefulTableViewController.podspec
@@ -1,15 +1,23 @@
Pod::Spec.new do |s|
s.name = 'JMStatefulTableViewController'
- s.version = '0.0.2'
- s.license = 'MIT'
- s.summary = 'A subclass-able way to cleanly and neatly implement a table view controller that has empty, loading and error states. Supports "paging" and pull to to refresh thanks to SVPullToRefresh.'
+ s.version = '0.1'
+
+ s.summary = 'A subclassable table view controller with empty, loading and error states, also supports infinte-scrolling and pull to refresh.'
+ s.description = 'A subclass-able way to cleanly and neatly implement a table view controller that has empty, loading and error states. Supports "paging" and pull to to refresh thanks to SVPullToRefresh.'
+
s.homepage = 'https://github.com/jakemarsh/JMStatefulTableViewController'
s.authors = { 'Jake Marsh' => 'jake@deallocatedobjects.com' }
- s.source = { :git => 'git://github.com/jakemarsh/JMStatefulTableViewController.git', :tag => '0.0.2' }
+ s.source = { :git => 'git://github.com/jakemarsh/JMStatefulTableViewController.git', :tag => '0.1' }
s.platform = :ios
+ s.requires_arc = true
+
+ s.license = {
+ :type => 'MIT',
+ :file => 'MIT-LICENSE'
+ }
- s.source_files = ['JMStatefulTableViewControllerDemo/JMStatefulTableViewController.*', 'JMStatefulTableViewControllerDemo/JMStatefulTableViewEmptyView.*', 'JMStatefulTableViewControllerDemo/JMStatefulTableViewLoadingView.*']
+ s.source_files = ['JMStatefulTableViewControllerDemo/JMStatefulTableViewController/*.*']
- s.dependency 'SVPullToRefresh'
+ s.dependency 'SVPullToRefresh'
end
View
25 ...ollerDemo/JMStatefulTableViewController.h → ...ontroller/JMStatefulTableViewController.h
@@ -3,12 +3,13 @@
// JMStatefulTableViewControllerDemo
//
// Created by Jake Marsh on 5/3/12.
-// Copyright (c) 2012 Rubber Duck Software. All rights reserved.
+// Copyright (c) 2012 Jake Marsh. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "JMStatefulTableViewLoadingView.h"
#import "JMStatefulTableViewEmptyView.h"
+#import "JMStatefulTableViewErrorView.h"
#import "SVPullToRefresh.h"
typedef enum {
@@ -17,7 +18,7 @@ typedef enum {
JMStatefulTableViewControllerStateLoadingFromPullToRefresh = 2,
JMStatefulTableViewControllerStateLoadingNextPage = 3,
JMStatefulTableViewControllerStateEmpty = 4,
- JMStatefulTableViewControllerErrorWhileInitiallyLoading = 5,
+ JMStatefulTableViewControllerError = 5,
} JMStatefulTableViewControllerState;
@class JMStatefulTableViewController;
@@ -27,19 +28,18 @@ typedef enum {
@required
- (void) statefulTableViewControllerWillBeginInitialLoading:(JMStatefulTableViewController *)vc completionBlock:(void (^)())success failure:(void (^)(NSError *error))failure;
+@required
- (void) statefulTableViewControllerWillBeginLoadingFromPullToRefresh:(JMStatefulTableViewController *)vc completionBlock:(void (^)(NSArray *indexPathsToInsert))success failure:(void (^)(NSError *error))failure;
+@required
- (void) statefulTableViewControllerWillBeginLoadingNextPage:(JMStatefulTableViewController *)vc completionBlock:(void (^)())success failure:(void (^)(NSError *error))failure;
-- (BOOL) statefulTableViewControllerShouldBeginLoadingNextPage:(JMStatefulTableViewController *)vc;
-- (NSInteger) statefulTableViewController:(JMStatefulTableViewController *)vc numberOfSectionsInTableView:(UITableView *)tableView;
-- (NSInteger) statefulTableViewController:(JMStatefulTableViewController *)vc tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
-
-- (UITableViewCell *) statefulTableViewController:(JMStatefulTableViewController *)vc tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
+@required
+- (BOOL) statefulTableViewControllerShouldBeginLoadingNextPage:(JMStatefulTableViewController *)vc;
@optional
-- (void) statefulTableViewControllerWillBeginLoading:(JMStatefulTableViewController *)vc;
-- (void) statefulTableViewControllerDidFinishLoading:(JMStatefulTableViewController *)vc;
+- (void) statefulTableViewController:(JMStatefulTableViewController *)vc willTransitionToState:(JMStatefulTableViewControllerState)state;
+- (void) statefulTableViewController:(JMStatefulTableViewController *)vc didTransitionToState:(JMStatefulTableViewControllerState)state;
@end
@@ -47,10 +47,11 @@ typedef enum {
@property (nonatomic) JMStatefulTableViewControllerState statefulState;
-@property (nonatomic, retain) UIView *emptyView;
-@property (nonatomic, retain) UIView *loadingView;
+@property (strong, nonatomic) UIView *emptyView;
+@property (strong, nonatomic) UIView *loadingView;
+@property (strong, nonatomic) UIView *errorView;
-@property (nonatomic, assign) id <JMStatefulTableViewControllerDelegate> statefulDelegate;
+@property (nonatomic, unsafe_unretained) id <JMStatefulTableViewControllerDelegate> statefulDelegate;
- (void) loadNewer;
View
149 ...ollerDemo/JMStatefulTableViewController.m → ...ontroller/JMStatefulTableViewController.m
@@ -3,7 +3,7 @@
// JMStatefulTableViewControllerDemo
//
// Created by Jake Marsh on 5/3/12.
-// Copyright (c) 2012 Rubber Duck Software. All rights reserved.
+// Copyright (c) 2012 Jake Marsh. All rights reserved.
//
#import "JMStatefulTableViewController.h"
@@ -37,6 +37,7 @@ @implementation JMStatefulTableViewController
@synthesize loadingView = _loadingView;
@synthesize emptyView = _emptyView;
+@synthesize errorView = _errorView;
@synthesize statefulDelegate = _statefulDelegate;
@@ -54,10 +55,7 @@ - (id) initWithStyle:(UITableViewStyle)style {
- (void) dealloc {
self.statefulDelegate = nil;
- [_loadingView release];
- [_emptyView release];
- [super dealloc];
}
#pragma mark - Loading Methods
@@ -77,10 +75,6 @@ - (void) _loadFirstPage {
[self.tableView reloadData];
- if([self.statefulDelegate respondsToSelector:@selector(statefulTableViewControllerWillBeginLoading:)]) {
- [self.statefulDelegate statefulTableViewControllerWillBeginLoading:self];
- }
-
[self.statefulDelegate statefulTableViewControllerWillBeginInitialLoading:self completionBlock:^{
[self.tableView reloadData]; // We have to call reloadData before we call _totalNumberOfRows otherwise the new count (after loading) won't be accurately reflected.
@@ -89,48 +83,36 @@ - (void) _loadFirstPage {
} else {
self.statefulState = JMStatefulTableViewControllerStateEmpty;
}
-
- if([self.statefulDelegate respondsToSelector:@selector(statefulTableViewControllerDidFinishLoading:)]) {
- [self.statefulDelegate statefulTableViewControllerDidFinishLoading:self];
- }
} failure:^(NSError *error) {
- self.statefulState = JMStatefulTableViewControllerErrorWhileInitiallyLoading;
-
- if([self.statefulDelegate respondsToSelector:@selector(statefulTableViewControllerDidFinishLoading:)]) {
- [self.statefulDelegate statefulTableViewControllerDidFinishLoading:self];
- }
+ self.statefulState = JMStatefulTableViewControllerError;
}];
}
- (void) _loadNextPage {
if(self.statefulState == JMStatefulTableViewControllerStateLoadingNextPage) return;
if([self.statefulDelegate statefulTableViewControllerShouldBeginLoadingNextPage:self]) {
+ self.tableView.showsInfiniteScrolling = YES;
+
self.statefulState = JMStatefulTableViewControllerStateLoadingNextPage;
- if([self.statefulDelegate respondsToSelector:@selector(statefulTableViewControllerWillBeginLoading:)]) {
- [self.statefulDelegate statefulTableViewControllerWillBeginLoading:self];
- }
-
[self.statefulDelegate statefulTableViewControllerWillBeginLoadingNextPage:self completionBlock:^{
[self.tableView reloadData];
+ if(![self.statefulDelegate statefulTableViewControllerShouldBeginLoadingNextPage:self]) {
+ self.tableView.showsInfiniteScrolling = NO;
+ };
+
if([self _totalNumberOfRows] > 0) {
self.statefulState = JMStatefulTableViewControllerStateIdle;
} else {
self.statefulState = JMStatefulTableViewControllerStateEmpty;
}
-
- if([self.statefulDelegate respondsToSelector:@selector(statefulTableViewControllerDidFinishLoading:)]) {
- [self.statefulDelegate statefulTableViewControllerDidFinishLoading:self];
- }
} failure:^(NSError *error) {
//TODO What should we do here?
self.statefulState = JMStatefulTableViewControllerStateIdle;
-
- if([self.statefulDelegate respondsToSelector:@selector(statefulTableViewControllerDidFinishLoading:)]) {
- [self.statefulDelegate statefulTableViewControllerDidFinishLoading:self];
- }
}];
+ } else {
+ self.tableView.showsInfiniteScrolling = NO;
}
}
@@ -139,10 +121,6 @@ - (void) _loadFromPullToRefresh {
self.statefulState = JMStatefulTableViewControllerStateLoadingFromPullToRefresh;
- if([self.statefulDelegate respondsToSelector:@selector(statefulTableViewControllerWillBeginLoading:)]) {
- [self.statefulDelegate statefulTableViewControllerWillBeginLoading:self];
- }
-
[self.statefulDelegate statefulTableViewControllerWillBeginLoadingFromPullToRefresh:self completionBlock:^(NSArray *indexPaths) {
if([indexPaths count] > 0) {
CGFloat totalHeights = [self _cumulativeHeightForCellsAtIndexPaths:indexPaths];
@@ -160,31 +138,22 @@ - (void) _loadFromPullToRefresh {
self.statefulState = JMStatefulTableViewControllerStateIdle;
[self.tableView.pullToRefreshView stopAnimating];
-
- if([self.statefulDelegate respondsToSelector:@selector(statefulTableViewControllerDidFinishLoading:)]) {
- [self.statefulDelegate statefulTableViewControllerDidFinishLoading:self];
- }
} failure:^(NSError *error) {
//TODO: What should we do here?
self.statefulState = JMStatefulTableViewControllerStateIdle;
[self.tableView.pullToRefreshView stopAnimating];
-
- if([self.statefulDelegate respondsToSelector:@selector(statefulTableViewControllerDidFinishLoading:)]) {
- [self.statefulDelegate statefulTableViewControllerDidFinishLoading:self];
- }
}];
}
#pragma mark - Table View Cells & NSIndexPaths
- (UITableViewCell *) _cellForLoadingCell {
- UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
+ UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
activityIndicator.center = cell.center;
[cell addSubview:activityIndicator];
- [activityIndicator release];
[activityIndicator startAnimating];
@@ -236,6 +205,10 @@ - (CGFloat) _cumulativeHeightForCellsAtIndexPaths:(NSArray *)indexPaths {
#pragma mark - Setter Overrides
- (void) setStatefulState:(JMStatefulTableViewControllerState)statefulState {
+ if([self.statefulDelegate respondsToSelector:@selector(statefulTableViewController:willTransitionToState:)]) {
+ [self.statefulDelegate statefulTableViewController:self willTransitionToState:statefulState];
+ }
+
_statefulState = statefulState;
switch (_statefulState) {
@@ -268,14 +241,20 @@ - (void) setStatefulState:(JMStatefulTableViewControllerState)statefulState {
// TODO
break;
- case JMStatefulTableViewControllerErrorWhileInitiallyLoading:
- // TODO
+ case JMStatefulTableViewControllerError:
+ self.tableView.backgroundView = self.errorView;
+ self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
+ self.tableView.scrollEnabled = NO;
[self.tableView reloadData];
break;
default:
break;
}
+
+ if([self.statefulDelegate respondsToSelector:@selector(statefulTableViewController:didTransitionToState:)]) {
+ [self.statefulDelegate statefulTableViewController:self didTransitionToState:statefulState];
+ }
}
#pragma mark - View Lifecycle
@@ -283,11 +262,14 @@ - (void) setStatefulState:(JMStatefulTableViewControllerState)statefulState {
- (void) loadView {
[super loadView];
- self.loadingView = [[[JMStatefulTableViewLoadingView alloc] initWithFrame:self.tableView.bounds] autorelease];
+ self.loadingView = [[JMStatefulTableViewLoadingView alloc] initWithFrame:self.tableView.bounds];
self.loadingView.backgroundColor = [UIColor greenColor];
- self.emptyView = [[[JMStatefulTableViewEmptyView alloc] initWithFrame:self.tableView.bounds] autorelease];
+ self.emptyView = [[JMStatefulTableViewEmptyView alloc] initWithFrame:self.tableView.bounds];
self.emptyView.backgroundColor = [UIColor yellowColor];
+
+ self.errorView = [[JMStatefulTableViewErrorView alloc] initWithFrame:self.tableView.bounds];
+ self.errorView.backgroundColor = [UIColor redColor];
}
- (void) viewDidLoad {
@@ -303,8 +285,14 @@ - (void) viewDidUnload {
- (void) viewWillAppear:(BOOL)animated {
[self _loadFirstPage];
+ __weak JMStatefulTableViewController *weakSelf = self;
+
[self.tableView addPullToRefreshWithActionHandler:^{
- [self _loadFromPullToRefresh];
+ [weakSelf _loadFromPullToRefresh];
+ }];
+
+ [self.tableView addInfiniteScrollingWithActionHandler:^{
+ [weakSelf _loadNextPage];
}];
[super viewWillAppear:animated];
@@ -314,54 +302,6 @@ - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfac
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-#pragma mark - Table view data source
-
-- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
- return [self.statefulDelegate statefulTableViewController:self numberOfSectionsInTableView:tableView];
-}
-
-- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- NSInteger rows = [self.statefulDelegate statefulTableViewController:self tableView:tableView numberOfRowsInSection:section];
-
- if(!self.isCountingRows) {
- if([self _indexRepresentsLastSection:section] && self.statefulState != JMStatefulTableViewControllerStateInitialLoading && [self.statefulDelegate statefulTableViewControllerShouldBeginLoadingNextPage:self]) {
- rows++;
- }
- }
-
- return rows;
-}
-
-- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- if([self _indexPathRepresentsLastRow:indexPath] && [self.statefulDelegate statefulTableViewControllerShouldBeginLoadingNextPage:self]) {
- return [self _cellForLoadingCell];
- } else {
- return [self.statefulDelegate statefulTableViewController:self tableView:self.tableView cellForRowAtIndexPath:indexPath];
- }
-
- static NSString *CellIdentifier = @"Cell";
-
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
- if(!cell) cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
-
- // Configure the cell...
-
- cell.textLabel.text = [NSString stringWithFormat:@"Section %d, Row %d", indexPath.section, indexPath.row];
-
- return cell;
-}
-- (void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
- if(cell.tag == kLoadingCellTag && [self.statefulDelegate statefulTableViewControllerShouldBeginLoadingNextPage:self]) {
- [self _loadNextPage];
- }
-}
-
-#pragma mark - Table view delegate
-
-- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-
-}
-
#pragma mark - JMStatefulTableViewControllerDelegate
- (void) statefulTableViewControllerWillBeginInitialLoading:(JMStatefulTableViewController *)vc completionBlock:(void (^)())success failure:(void (^)(NSError *error))failure {
@@ -381,21 +321,4 @@ - (BOOL) statefulTableViewControllerShouldBeginLoadingNextPage:(JMStatefulTableV
return NO;
}
-- (NSInteger) statefulTableViewController:(JMStatefulTableViewController *)vc numberOfSectionsInTableView:(UITableView *)tableView {
- NSAssert(NO, @"statefulTableViewController:numberOfSectionsInTableView: is meant to be implementd by it's subclasses!");
-
- return 0;
-}
-- (NSInteger) statefulTableViewController:(JMStatefulTableViewController *)vc tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- NSAssert(NO, @"statefulTableViewController:tableView:numberOfRowsInSection: is meant to be implementd by it's subclasses!");
-
- return 0;
-}
-
-- (UITableViewCell *) statefulTableViewController:(JMStatefulTableViewController *)vc tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- NSAssert(NO, @"statefulTableViewController:tableView:cellForRowAtIndexPath: is meant to be implementd by it's subclasses!");
-
- return nil;
-}
-
@end
View
4 ...rollerDemo/JMStatefulTableViewEmptyView.h → ...Controller/JMStatefulTableViewEmptyView.h
@@ -3,11 +3,11 @@
// JMStatefulTableViewControllerDemo
//
// Created by Jake Marsh on 5/3/12.
-// Copyright (c) 2012 Rubber Duck Software. All rights reserved.
+// Copyright (c) 2012 Jake Marsh. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface JMStatefulTableViewEmptyView : UIView
-@end
+@end
View
11 ...rollerDemo/JMStatefulTableViewEmptyView.m → ...Controller/JMStatefulTableViewEmptyView.m
@@ -3,7 +3,7 @@
// JMStatefulTableViewControllerDemo
//
// Created by Jake Marsh on 5/3/12.
-// Copyright (c) 2012 Rubber Duck Software. All rights reserved.
+// Copyright (c) 2012 Jake Marsh. All rights reserved.
//
#import "JMStatefulTableViewEmptyView.h"
@@ -19,13 +19,4 @@ - (id) initWithFrame:(CGRect)frame {
return self;
}
-/*
-// Only override drawRect: if you perform custom drawing.
-// An empty implementation adversely affects performance during animation.
-- (void)drawRect:(CGRect)rect
-{
- // Drawing code
-}
-*/
-
@end
View
13 JMStatefulTableViewController/JMStatefulTableViewErrorView.h
@@ -0,0 +1,13 @@
+//
+// JMStatefulTableViewErrorView.h
+// JMStatefulTableViewControllerDemo
+//
+// Created by Jake Marsh on 7/22/12.
+// Copyright (c) 2012 Jake Marsh. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface JMStatefulTableViewErrorView : UIView
+
+@end
View
22 JMStatefulTableViewController/JMStatefulTableViewErrorView.m
@@ -0,0 +1,22 @@
+//
+// JMStatefulTableViewErrorView.m
+// JMStatefulTableViewControllerDemo
+//
+// Created by Jake Marsh on 7/22/12.
+// Copyright (c) 2012 Jake Marsh. All rights reserved.
+//
+
+#import "JMStatefulTableViewErrorView.h"
+
+@implementation JMStatefulTableViewErrorView
+
+- (id) initWithFrame:(CGRect)frame {
+ self = [super initWithFrame:frame];
+ if (!self) return nil;
+
+
+
+ return self;
+}
+
+@end
View
2  ...llerDemo/JMStatefulTableViewLoadingView.h → ...ntroller/JMStatefulTableViewLoadingView.h
@@ -3,7 +3,7 @@
// JMStatefulTableViewControllerDemo
//
// Created by Jake Marsh on 5/3/12.
-// Copyright (c) 2012 Rubber Duck Software. All rights reserved.
+// Copyright (c) 2012 Jake Marsh. All rights reserved.
//
#import <UIKit/UIKit.h>
View
13 ...llerDemo/JMStatefulTableViewLoadingView.m → ...ntroller/JMStatefulTableViewLoadingView.m
@@ -3,7 +3,7 @@
// JMStatefulTableViewControllerDemo
//
// Created by Jake Marsh on 5/3/12.
-// Copyright (c) 2012 Rubber Duck Software. All rights reserved.
+// Copyright (c) 2012 Jake Marsh. All rights reserved.
//
#import "JMStatefulTableViewLoadingView.h"
@@ -19,13 +19,4 @@ - (id) initWithFrame:(CGRect)frame {
return self;
}
-/*
-// Only override drawRect: if you perform custom drawing.
-// An empty implementation adversely affects performance during animation.
-- (void)drawRect:(CGRect)rect
-{
- // Drawing code
-}
-*/
-
-@end
+@end
View
64 JMStatefulTableViewControllerDemo.xcodeproj/project.pbxproj
@@ -7,20 +7,29 @@
objects = {
/* Begin PBXBuildFile section */
+ 304DA1FF15BD01FB00C7F9BF /* JMStatefulTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 304DA1F815BD01FB00C7F9BF /* JMStatefulTableViewController.m */; };
+ 304DA20015BD01FB00C7F9BF /* JMStatefulTableViewEmptyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 304DA1FA15BD01FB00C7F9BF /* JMStatefulTableViewEmptyView.m */; };
+ 304DA20115BD01FB00C7F9BF /* JMStatefulTableViewErrorView.m in Sources */ = {isa = PBXBuildFile; fileRef = 304DA1FC15BD01FB00C7F9BF /* JMStatefulTableViewErrorView.m */; };
+ 304DA20215BD01FB00C7F9BF /* JMStatefulTableViewLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 304DA1FE15BD01FB00C7F9BF /* JMStatefulTableViewLoadingView.m */; };
30BD9BE01553077A006B103A /* DemoTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 30BD9BDF1553077A006B103A /* DemoTableViewController.m */; };
30CAA0E11552CA980010293B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30CAA0E01552CA980010293B /* UIKit.framework */; };
30CAA0E31552CA980010293B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30CAA0E21552CA980010293B /* Foundation.framework */; };
30CAA0E51552CA980010293B /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30CAA0E41552CA980010293B /* CoreGraphics.framework */; };
30CAA0EB1552CA980010293B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 30CAA0E91552CA980010293B /* InfoPlist.strings */; };
30CAA0ED1552CA980010293B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 30CAA0EC1552CA980010293B /* main.m */; };
- 30CAA0F11552CA980010293B /* JMAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 30CAA0F01552CA980010293B /* JMAppDelegate.m */; };
- 30CAA0F91552CABF0010293B /* JMStatefulTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 30CAA0F81552CABF0010293B /* JMStatefulTableViewController.m */; };
- 30CAA1071552CBD40010293B /* JMStatefulTableViewEmptyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 30CAA1061552CBD40010293B /* JMStatefulTableViewEmptyView.m */; };
- 30CAA10B1552CC0B0010293B /* JMStatefulTableViewLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 30CAA10A1552CC0B0010293B /* JMStatefulTableViewLoadingView.m */; };
+ 30CAA0F11552CA980010293B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 30CAA0F01552CA980010293B /* AppDelegate.m */; };
C7656E72079147278CF8996A /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6FE64582D301446980CC3EFE /* libPods.a */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
+ 304DA1F715BD01FB00C7F9BF /* JMStatefulTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMStatefulTableViewController.h; sourceTree = "<group>"; };
+ 304DA1F815BD01FB00C7F9BF /* JMStatefulTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMStatefulTableViewController.m; sourceTree = "<group>"; };
+ 304DA1F915BD01FB00C7F9BF /* JMStatefulTableViewEmptyView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMStatefulTableViewEmptyView.h; sourceTree = "<group>"; };
+ 304DA1FA15BD01FB00C7F9BF /* JMStatefulTableViewEmptyView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMStatefulTableViewEmptyView.m; sourceTree = "<group>"; };
+ 304DA1FB15BD01FB00C7F9BF /* JMStatefulTableViewErrorView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMStatefulTableViewErrorView.h; sourceTree = "<group>"; };
+ 304DA1FC15BD01FB00C7F9BF /* JMStatefulTableViewErrorView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMStatefulTableViewErrorView.m; sourceTree = "<group>"; };
+ 304DA1FD15BD01FB00C7F9BF /* JMStatefulTableViewLoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMStatefulTableViewLoadingView.h; sourceTree = "<group>"; };
+ 304DA1FE15BD01FB00C7F9BF /* JMStatefulTableViewLoadingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMStatefulTableViewLoadingView.m; sourceTree = "<group>"; };
30BD9BDE1553077A006B103A /* DemoTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoTableViewController.h; sourceTree = "<group>"; };
30BD9BDF1553077A006B103A /* DemoTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoTableViewController.m; sourceTree = "<group>"; };
30CAA0DC1552CA980010293B /* JMStatefulTableViewControllerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JMStatefulTableViewControllerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -31,14 +40,8 @@
30CAA0EA1552CA980010293B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
30CAA0EC1552CA980010293B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
30CAA0EE1552CA980010293B /* JMStatefulTableViewControllerDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JMStatefulTableViewControllerDemo-Prefix.pch"; sourceTree = "<group>"; };
- 30CAA0EF1552CA980010293B /* JMAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JMAppDelegate.h; sourceTree = "<group>"; };
- 30CAA0F01552CA980010293B /* JMAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JMAppDelegate.m; sourceTree = "<group>"; };
- 30CAA0F71552CABF0010293B /* JMStatefulTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; path = JMStatefulTableViewController.h; sourceTree = "<group>"; };
- 30CAA0F81552CABF0010293B /* JMStatefulTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMStatefulTableViewController.m; sourceTree = "<group>"; };
- 30CAA1051552CBD40010293B /* JMStatefulTableViewEmptyView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMStatefulTableViewEmptyView.h; sourceTree = "<group>"; };
- 30CAA1061552CBD40010293B /* JMStatefulTableViewEmptyView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMStatefulTableViewEmptyView.m; sourceTree = "<group>"; };
- 30CAA1091552CC0B0010293B /* JMStatefulTableViewLoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMStatefulTableViewLoadingView.h; sourceTree = "<group>"; };
- 30CAA10A1552CC0B0010293B /* JMStatefulTableViewLoadingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMStatefulTableViewLoadingView.m; sourceTree = "<group>"; };
+ 30CAA0EF1552CA980010293B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 30CAA0F01552CA980010293B /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
6FE64582D301446980CC3EFE /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
E6CF65DC10EE494FA0570F0C /* Pods.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
@@ -58,6 +61,21 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ 304DA1F615BD01FB00C7F9BF /* JMStatefulTableViewController */ = {
+ isa = PBXGroup;
+ children = (
+ 304DA1F715BD01FB00C7F9BF /* JMStatefulTableViewController.h */,
+ 304DA1F815BD01FB00C7F9BF /* JMStatefulTableViewController.m */,
+ 304DA1F915BD01FB00C7F9BF /* JMStatefulTableViewEmptyView.h */,
+ 304DA1FA15BD01FB00C7F9BF /* JMStatefulTableViewEmptyView.m */,
+ 304DA1FB15BD01FB00C7F9BF /* JMStatefulTableViewErrorView.h */,
+ 304DA1FC15BD01FB00C7F9BF /* JMStatefulTableViewErrorView.m */,
+ 304DA1FD15BD01FB00C7F9BF /* JMStatefulTableViewLoadingView.h */,
+ 304DA1FE15BD01FB00C7F9BF /* JMStatefulTableViewLoadingView.m */,
+ );
+ path = JMStatefulTableViewController;
+ sourceTree = SOURCE_ROOT;
+ };
30CAA0D11552CA970010293B = {
isa = PBXGroup;
children = (
@@ -90,17 +108,12 @@
30CAA0E61552CA980010293B /* JMStatefulTableViewControllerDemo */ = {
isa = PBXGroup;
children = (
- 30CAA0EF1552CA980010293B /* JMAppDelegate.h */,
- 30CAA0F01552CA980010293B /* JMAppDelegate.m */,
+ 30CAA0EF1552CA980010293B /* AppDelegate.h */,
+ 30CAA0F01552CA980010293B /* AppDelegate.m */,
30BD9BDE1553077A006B103A /* DemoTableViewController.h */,
30BD9BDF1553077A006B103A /* DemoTableViewController.m */,
+ 304DA1F615BD01FB00C7F9BF /* JMStatefulTableViewController */,
30CAA0E71552CA980010293B /* Supporting Files */,
- 30CAA0F71552CABF0010293B /* JMStatefulTableViewController.h */,
- 30CAA0F81552CABF0010293B /* JMStatefulTableViewController.m */,
- 30CAA1051552CBD40010293B /* JMStatefulTableViewEmptyView.h */,
- 30CAA1061552CBD40010293B /* JMStatefulTableViewEmptyView.m */,
- 30CAA1091552CC0B0010293B /* JMStatefulTableViewLoadingView.h */,
- 30CAA10A1552CC0B0010293B /* JMStatefulTableViewLoadingView.m */,
);
path = JMStatefulTableViewControllerDemo;
sourceTree = "<group>";
@@ -198,11 +211,12 @@
buildActionMask = 2147483647;
files = (
30CAA0ED1552CA980010293B /* main.m in Sources */,
- 30CAA0F11552CA980010293B /* JMAppDelegate.m in Sources */,
- 30CAA0F91552CABF0010293B /* JMStatefulTableViewController.m in Sources */,
- 30CAA1071552CBD40010293B /* JMStatefulTableViewEmptyView.m in Sources */,
- 30CAA10B1552CC0B0010293B /* JMStatefulTableViewLoadingView.m in Sources */,
+ 30CAA0F11552CA980010293B /* AppDelegate.m in Sources */,
30BD9BE01553077A006B103A /* DemoTableViewController.m in Sources */,
+ 304DA1FF15BD01FB00C7F9BF /* JMStatefulTableViewController.m in Sources */,
+ 304DA20015BD01FB00C7F9BF /* JMStatefulTableViewEmptyView.m in Sources */,
+ 304DA20115BD01FB00C7F9BF /* JMStatefulTableViewErrorView.m in Sources */,
+ 304DA20215BD01FB00C7F9BF /* JMStatefulTableViewLoadingView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -267,6 +281,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = E6CF65DC10EE494FA0570F0C /* Pods.xcconfig */;
buildSettings = {
+ CLANG_ENABLE_OBJC_ARC = YES;
DSTROOT = /tmp/xcodeproj.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "JMStatefulTableViewControllerDemo/JMStatefulTableViewControllerDemo-Prefix.pch";
@@ -282,6 +297,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = E6CF65DC10EE494FA0570F0C /* Pods.xcconfig */;
buildSettings = {
+ CLANG_ENABLE_OBJC_ARC = YES;
DSTROOT = /tmp/xcodeproj.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "JMStatefulTableViewControllerDemo/JMStatefulTableViewControllerDemo-Prefix.pch";
View
BIN  JMStatefulTableViewControllerDemo/.DS_Store
Binary file not shown
View
4 ...ulTableViewControllerDemo/JMAppDelegate.h → ...efulTableViewControllerDemo/AppDelegate.h
@@ -3,12 +3,12 @@
// JMStatefulTableViewControllerDemo
//
// Created by Jake Marsh on 5/3/12.
-// Copyright (c) 2012 Rubber Duck Software. All rights reserved.
+// Copyright (c) 2012 Jake Marsh. All rights reserved.
//
#import <UIKit/UIKit.h>
-@interface JMAppDelegate : UIResponder <UIApplicationDelegate>
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
View
14 ...ulTableViewControllerDemo/JMAppDelegate.m → ...efulTableViewControllerDemo/AppDelegate.m
@@ -3,24 +3,19 @@
// JMStatefulTableViewControllerDemo
//
// Created by Jake Marsh on 5/3/12.
-// Copyright (c) 2012 Rubber Duck Software. All rights reserved.
+// Copyright (c) 2012 Jake Marsh. All rights reserved.
//
-#import "JMAppDelegate.h"
+#import "AppDelegate.h"
#import "DemoTableViewController.h"
-@implementation JMAppDelegate
+@implementation AppDelegate
@synthesize window = _window;
-- (void)dealloc
-{
- [_window release];
- [super dealloc];
-}
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
@@ -30,7 +25,6 @@ - (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:
self.window.rootViewController = vc;
- [vc release];
return YES;
}
View
2  JMStatefulTableViewControllerDemo/DemoTableViewController.h
@@ -3,7 +3,7 @@
// JMStatefulTableViewControllerDemo
//
// Created by Jake Marsh on 5/3/12.
-// Copyright (c) 2012 Rubber Duck Software. All rights reserved.
+// Copyright (c) 2012 Jake Marsh. All rights reserved.
//
#import "JMStatefulTableViewController.h"
View
59 JMStatefulTableViewControllerDemo/DemoTableViewController.m
@@ -3,14 +3,15 @@
// JMStatefulTableViewControllerDemo
//
// Created by Jake Marsh on 5/3/12.
-// Copyright (c) 2012 Rubber Duck Software. All rights reserved.
+// Copyright (c) 2012 Jake Marsh. All rights reserved.
//
#import "DemoTableViewController.h"
@interface DemoTableViewController ()
-@property (nonatomic, retain) NSArray *beers;
+@property (nonatomic) NSArray *beers;
+
- (NSArray *) _twentyRandomBeerStrings;
@end
@@ -28,6 +29,8 @@ - (id) initWithStyle:(UITableViewStyle)style {
return self;
}
+#pragma mark - Private Methods
+
- (NSArray *) _twentyRandomBeerStrings {
return [NSArray arrayWithObjects:@"Budweiser", @"Iron City", @"Amstel Light", @"Red Stripe", @"Smithwicks", @"Foster’s", @"Victory", @"Corona", @"Ommegang", @"Chimay", @"Stella Artois", @"Paulaner", @"Newcastle", @"Samuel Adams", @"Rogue", @"Sam Smith’s", @"Yuengling", @"Guinness", @"Sierra Nevada", @"Westvleteren", nil];
}
@@ -37,15 +40,38 @@ - (NSArray *) _twentyRandomBeerStrings {
- (void) viewDidLoad {
[super viewDidLoad];
}
-
-- (void) viewDidUnload {
- [super viewDidUnload];
+- (void) didReceiveMemoryWarning {
+
}
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
+#pragma mark - UITableViewDataSource
+
+- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+ return 1;
+}
+- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ return self.beers.count;
+}
+
+- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ static NSString *CellIdentifier = @"BeerCell";
+
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+ if(!cell) {
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
+ }
+
+ NSString *beer = [self.beers objectAtIndex:indexPath.row];
+
+ cell.textLabel.text = beer;
+
+ return cell;
+}
+
#pragma mark - UITableViewDelegate
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -97,30 +123,9 @@ - (void) statefulTableViewControllerWillBeginLoadingNextPage:(JMStatefulTableVie
});
});
}
+
- (BOOL) statefulTableViewControllerShouldBeginLoadingNextPage:(JMStatefulTableViewController *)vc {
return self.beers.count <= 100;
}
-- (NSInteger) statefulTableViewController:(JMStatefulTableViewController *)vc numberOfSectionsInTableView:(UITableView *)tableView {
- return 1;
-}
-- (NSInteger) statefulTableViewController:(JMStatefulTableViewController *)vc tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return self.beers.count;
-}
-
-- (UITableViewCell *) statefulTableViewController:(JMStatefulTableViewController *)vc tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- static NSString *CellIdentifier = @"BeerCell";
-
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
- if(!cell) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
- }
-
- NSString *beer = [self.beers objectAtIndex:indexPath.row];
-
- cell.textLabel.text = beer;
-
- return cell;
-}
-
@end
View
6 JMStatefulTableViewControllerDemo/main.m
@@ -3,15 +3,15 @@
// JMStatefulTableViewControllerDemo
//
// Created by Jake Marsh on 5/3/12.
-// Copyright (c) 2012 Rubber Duck Software. All rights reserved.
+// Copyright (c) 2012 Jake Marsh. All rights reserved.
//
#import <UIKit/UIKit.h>
-#import "JMAppDelegate.h"
+#import "AppDelegate.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
- return UIApplicationMain(argc, argv, nil, NSStringFromClass([JMAppDelegate class]));
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
View
20 MIT-LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2012 Jake Marsh and other contributors.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
3  Podfile
@@ -1,4 +1,3 @@
platform :ios
-dependency 'SVPullToRefresh'
-
+pod 'SVPullToRefresh'
View
2  Podfile.lock
@@ -1,5 +1,5 @@
PODS:
- - SVPullToRefresh (0.1)
+ - SVPullToRefresh (0.2)
DEPENDENCIES:
- SVPullToRefresh
View
13 Pods/Pods-Acknowledgements.markdown
@@ -0,0 +1,13 @@
+# Acknowledgements
+This application makes use of the following third party libraries:
+
+## SVPullToRefresh
+
+Copyright (C) 2012 Sam Vermette
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+Generated by CocoaPods - http://cocoapods.org
View
43 Pods/Pods-Acknowledgements.plist
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>PreferenceSpecifiers</key>
+ <array>
+ <dict>
+ <key>FooterText</key>
+ <string>This application makes use of the following third party libraries:</string>
+ <key>Title</key>
+ <string>Acknowledgements</string>
+ <key>Type</key>
+ <string>PSGroupSpecifier</string>
+ </dict>
+ <dict>
+ <key>FooterText</key>
+ <string>Copyright (C) 2012 Sam Vermette
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</string>
+ <key>Title</key>
+ <string>SVPullToRefresh</string>
+ <key>Type</key>
+ <string>PSGroupSpecifier</string>
+ </dict>
+ <dict>
+ <key>FooterText</key>
+ <string>Generated by CocoaPods - http://cocoapods.org</string>
+ <key>Title</key>
+ <string></string>
+ <key>Type</key>
+ <string>PSGroupSpecifier</string>
+ </dict>
+ </array>
+ <key>StringsTable</key>
+ <string>Acknowledgements</string>
+ <key>Title</key>
+ <string>Acknowledgements</string>
+</dict>
+</plist>
View
13 Pods/Pods-resources.sh
@@ -3,14 +3,17 @@
install_resource()
{
case $1 in
+ *.storyboard)
+ echo "ibtool --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename $1 .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
+ ibtool --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename $1 .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
+ ;;
*.xib)
- echo "ibtool --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename $1 .xib`.nib ${SRCROOT}/Pods/$1 --sdk ${SDKROOT}"
- ibtool --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename $1 .xib`.nib ${SRCROOT}/Pods/$1 --sdk ${SDKROOT}
+ echo "ibtool --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename $1 .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
+ ibtool --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename $1 .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
;;
*)
- echo "cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
- cp -R "${SRCROOT}/Pods/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
+ echo "cp -R ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
+ cp -R "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
;;
esac
}
-install_resource 'SVPullToRefresh/SVPullToRefresh/SVPullToRefresh.bundle'
View
6 Pods/Pods.xcconfig
@@ -1,4 +1,4 @@
-PODS_ROOT = $(SRCROOT)/Pods
-HEADER_SEARCH_PATHS = "$(PODS_ROOT)/Headers" "$(PODS_ROOT)/Headers/SVPullToRefresh"
+PODS_ROOT = ${SRCROOT}/Pods
ALWAYS_SEARCH_USER_PATHS = YES
-OTHER_LDFLAGS = -ObjC -all_load -framework QuartzCore
+OTHER_LDFLAGS = -ObjC -framework QuartzCore
+HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/SVPullToRefresh"
View
486 Pods/Pods.xcodeproj/project.pbxproj
@@ -10,119 +10,34 @@
<string>46</string>
<key>objects</key>
<dict>
- <key>131521FA769748409B644AB1</key>
- <dict>
- <key>buildConfigurationList</key>
- <string>C8EDE91C083D4361AAFC3185</string>
- <key>buildPhases</key>
- <array>
- <string>CE9262B13B74469BB397BBA5</string>
- <string>321D8E94E2C546BBB6890F14</string>
- <string>BA1A59FEBD3640B9BAFE68C8</string>
- </array>
- <key>buildRules</key>
- <array/>
- <key>dependencies</key>
- <array/>
- <key>isa</key>
- <string>PBXNativeTarget</string>
- <key>name</key>
- <string>Pods</string>
- <key>productName</key>
- <string>Pods</string>
- <key>productReference</key>
- <string>A2BDB84D1AB54BBDA0F91C72</string>
- <key>productType</key>
- <string>com.apple.product-type.library.static</string>
- </dict>
- <key>15AEF9939DCE4C38A471397C</key>
+ <key>06410CCAE34944B8B075FC1B</key>
<dict>
<key>children</key>
<array>
- <string>694E525D2E944CCDA7D05EDF</string>
- <string>387335721F22432198D64721</string>
+ <string>350AC8EC348C4A0FB51F2184</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
- <string>SVPullToRefresh</string>
+ <string>Pods</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
- <key>1C66B765DDB549BB9D49367E</key>
+ <key>06BAAB6950CF4A8D8B9C23ED</key>
<dict>
- <key>buildSettings</key>
- <dict>
- <key>ALWAYS_SEARCH_USER_PATHS</key>
- <string>NO</string>
- <key>ARCHS</key>
- <string>$(ARCHS_STANDARD_32_BIT)</string>
- <key>COPY_PHASE_STRIP</key>
- <string>YES</string>
- <key>DSTROOT</key>
- <string>/tmp/xcodeproj.dst</string>
- <key>GCC_C_LANGUAGE_STANDARD</key>
- <string>gnu99</string>
- <key>GCC_PRECOMPILE_PREFIX_HEADER</key>
- <string>YES</string>
- <key>GCC_VERSION</key>
- <string>com.apple.compilers.llvmgcc42</string>
- <key>GCC_WARN_ABOUT_MISSING_PROTOTYPES</key>
- <string>YES</string>
- <key>GCC_WARN_ABOUT_RETURN_TYPE</key>
- <string>YES</string>
- <key>GCC_WARN_UNUSED_VARIABLE</key>
- <string>YES</string>
- <key>INSTALL_PATH</key>
- <string>$(BUILT_PRODUCTS_DIR)</string>
- <key>IPHONEOS_DEPLOYMENT_TARGET</key>
- <string>4.3</string>
- <key>OTHER_LDFLAGS</key>
- <string></string>
- <key>PRODUCT_NAME</key>
- <string>$(TARGET_NAME)</string>
- <key>PUBLIC_HEADERS_FOLDER_PATH</key>
- <string>$(TARGET_NAME)</string>
- <key>SDKROOT</key>
- <string>iphoneos</string>
- <key>SKIP_INSTALL</key>
- <string>YES</string>
- <key>VALIDATE_PRODUCT</key>
- <string>YES</string>
- </dict>
- <key>isa</key>
- <string>XCBuildConfiguration</string>
- <key>name</key>
- <string>Release</string>
- </dict>
- <key>1F0F67AD8D104E32945613DC</key>
- <dict>
- <key>buildConfigurations</key>
- <array>
- <string>7A788B5FBDF04F4B8F01AE8D</string>
- <string>1C66B765DDB549BB9D49367E</string>
- </array>
- <key>defaultConfigurationIsVisible</key>
- <string>0</string>
- <key>defaultConfigurationName</key>
- <string>Release</string>
+ <key>fileRef</key>
+ <string>D956DA65E79A4AA3AA1CDEE1</string>
<key>isa</key>
- <string>XCConfigurationList</string>
+ <string>PBXBuildFile</string>
</dict>
- <key>321D8E94E2C546BBB6890F14</key>
+ <key>0B46C0469E864DFF9A1F22D1</key>
<dict>
- <key>buildActionMask</key>
- <string>2147483647</string>
- <key>files</key>
- <array>
- <string>B26766EFE91D4819984570D8</string>
- </array>
+ <key>fileRef</key>
+ <string>67A7CE780A2B449596D77A8F</string>
<key>isa</key>
- <string>PBXFrameworksBuildPhase</string>
- <key>runOnlyForDeploymentPostprocessing</key>
- <string>0</string>
+ <string>PBXBuildFile</string>
</dict>
- <key>360DE8EB6F914010A962D970</key>
+ <key>16DABB0DDA0F4D40814FDAF0</key>
<dict>
<key>attributes</key>
<dict>
@@ -130,7 +45,7 @@
<string>0420</string>
</dict>
<key>buildConfigurationList</key>
- <string>1F0F67AD8D104E32945613DC</string>
+ <string>C9185CAD8CA643CE8C316BD3</string>
<key>compatibilityVersion</key>
<string>Xcode 3.2</string>
<key>developmentRegion</key>
@@ -144,20 +59,22 @@
<string>en</string>
</array>
<key>mainGroup</key>
- <string>7EB1868B71D84DBA8A6910B8</string>
+ <string>412A681B33FE4CA9A6920E1E</string>
<key>productRefGroup</key>
- <string>D8875DD727D94EAFAC4FC911</string>
+ <string>19FB720C3D594F38B1142B4E</string>
<key>projectDirPath</key>
<string></string>
<key>projectRoot</key>
<string></string>
<key>targets</key>
<array>
- <string>131521FA769748409B644AB1</string>
+ <string>816160BCBCDC414D9D7B8695</string>
</array>
</dict>
- <key>387335721F22432198D64721</key>
+ <key>18FB38796B0348B08464B799</key>
<dict>
+ <key>includeInIndex</key>
+ <string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
@@ -167,103 +84,112 @@
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
- <key>60A766F2474443F2A2074AE5</key>
+ <key>19FB720C3D594F38B1142B4E</key>
<dict>
<key>children</key>
<array>
- <string>F1EBDAA4942447AA9FACDF80</string>
- <string>9447C0AB2D294AD1879FF9EF</string>
- <string>D6758442F68D49D0962452B3</string>
+ <string>C1528FD39C0448EFAFB3C388</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
- <string>Pods</string>
+ <string>Products</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
- <key>694E525D2E944CCDA7D05EDF</key>
+ <key>350AC8EC348C4A0FB51F2184</key>
<dict>
+ <key>children</key>
+ <array>
+ <string>9CA57A0188324B58886343A9</string>
+ <string>18FB38796B0348B08464B799</string>
+ </array>
<key>isa</key>
- <string>PBXFileReference</string>
+ <string>PBXGroup</string>
<key>name</key>
- <string>SVPullToRefresh.h</string>
- <key>path</key>
- <string>SVPullToRefresh/SVPullToRefresh/SVPullToRefresh.h</string>
+ <string>SVPullToRefresh</string>
<key>sourceTree</key>
- <string>SOURCE_ROOT</string>
+ <string>&lt;group&gt;</string>
</dict>
- <key>6A11130C7BD94AF6830157C2</key>
+ <key>412A681B33FE4CA9A6920E1E</key>
<dict>
<key>children</key>
<array>
- <string>60A766F2474443F2A2074AE5</string>
+ <string>19FB720C3D594F38B1142B4E</string>
+ <string>06410CCAE34944B8B075FC1B</string>
+ <string>7EC3317376B64EEDB7472C7D</string>
+ <string>B8E9B91FEDF6424987053EAB</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
- <key>name</key>
- <string>Targets Support Files</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
- <key>6C6592B3566F4735BE06742F</key>
+ <key>4D01FCDF06834BDB83D5E813</key>
<dict>
- <key>baseConfigurationReference</key>
- <string>D6758442F68D49D0962452B3</string>
- <key>buildSettings</key>
- <dict>
- <key>DSTROOT</key>
- <string>/tmp/xcodeproj.dst</string>
- <key>GCC_PRECOMPILE_PREFIX_HEADER</key>
- <string>YES</string>
- <key>GCC_PREFIX_HEADER</key>
- <string>Pods-prefix.pch</string>
- <key>GCC_VERSION</key>
- <string>com.apple.compilers.llvm.clang.1_0</string>
- <key>OTHER_LDFLAGS</key>
- <string></string>
- <key>PODS_ROOT</key>
- <string>$(SRCROOT)</string>
- <key>PRODUCT_NAME</key>
- <string>$(TARGET_NAME)</string>
- <key>SKIP_INSTALL</key>
- <string>YES</string>
- </dict>
+ <key>includeInIndex</key>
+ <string>1</string>
<key>isa</key>
- <string>XCBuildConfiguration</string>
+ <string>PBXFileReference</string>
+ <key>lastKnownFileType</key>
+ <string>text.xcconfig</string>
<key>name</key>
- <string>Debug</string>
+ <string>Pods.xcconfig</string>
+ <key>path</key>
+ <string>Pods.xcconfig</string>
+ <key>sourceTree</key>
+ <string>SOURCE_ROOT</string>
</dict>
- <key>7603C1A85FD447CC847263F4</key>
+ <key>6373E7CDD93B4A78AD65FFE9</key>
<dict>
<key>baseConfigurationReference</key>
- <string>D6758442F68D49D0962452B3</string>
+ <string>4D01FCDF06834BDB83D5E813</string>
<key>buildSettings</key>
<dict>
+ <key>ALWAYS_SEARCH_USER_PATHS</key>
+ <string>NO</string>
+ <key>ARCHS</key>
+ <string>$(ARCHS_STANDARD_32_BIT)</string>
+ <key>COPY_PHASE_STRIP</key>
+ <string>YES</string>
<key>DSTROOT</key>
<string>/tmp/xcodeproj.dst</string>
+ <key>GCC_C_LANGUAGE_STANDARD</key>
+ <string>gnu99</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>Pods-prefix.pch</string>
<key>GCC_VERSION</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
+ <key>INSTALL_PATH</key>
+ <string>$(BUILT_PRODUCTS_DIR)</string>
+ <key>IPHONEOS_DEPLOYMENT_TARGET</key>
+ <string>4.3</string>
<key>OTHER_LDFLAGS</key>
<string></string>
<key>PODS_ROOT</key>
- <string>$(SRCROOT)</string>
+ <string>${SRCROOT}</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
+ <key>PUBLIC_HEADERS_FOLDER_PATH</key>
+ <string>$(TARGET_NAME)</string>
+ <key>SDKROOT</key>
+ <string>iphoneos</string>
<key>SKIP_INSTALL</key>
<string>YES</string>
+ <key>VALIDATE_PRODUCT</key>
+ <string>YES</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
- <key>7701D76ED7904E09A702AD8E</key>
+ <key>67A7CE780A2B449596D77A8F</key>
<dict>
+ <key>includeInIndex</key>
+ <string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
@@ -275,8 +201,10 @@
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
- <key>7A788B5FBDF04F4B8F01AE8D</key>
+ <key>71C0AC77A0FC4EE39DE4D678</key>
<dict>
+ <key>baseConfigurationReference</key>
+ <string>4D01FCDF06834BDB83D5E813</string>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
@@ -295,6 +223,8 @@
<string>0</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
+ <key>GCC_PREFIX_HEADER</key>
+ <string>Pods-prefix.pch</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<array>
<string>DEBUG=1</string>
@@ -303,19 +233,15 @@
<key>GCC_SYMBOLS_PRIVATE_EXTERN</key>
<string>NO</string>
<key>GCC_VERSION</key>
- <string>com.apple.compilers.llvmgcc42</string>
- <key>GCC_WARN_ABOUT_MISSING_PROTOTYPES</key>
- <string>YES</string>
- <key>GCC_WARN_ABOUT_RETURN_TYPE</key>
- <string>YES</string>
- <key>GCC_WARN_UNUSED_VARIABLE</key>
- <string>YES</string>
+ <string>com.apple.compilers.llvm.clang.1_0</string>
<key>INSTALL_PATH</key>
<string>$(BUILT_PRODUCTS_DIR)</string>
<key>IPHONEOS_DEPLOYMENT_TARGET</key>
<string>4.3</string>
<key>OTHER_LDFLAGS</key>
<string></string>
+ <key>PODS_ROOT</key>
+ <string>${SRCROOT}</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
@@ -330,22 +256,101 @@
<key>name</key>
<string>Debug</string>
</dict>
- <key>7EB1868B71D84DBA8A6910B8</key>
+ <key>78B25303209B469CA78B8BF6</key>
+ <dict>
+ <key>buildActionMask</key>
+ <string>2147483647</string>
+ <key>files</key>
+ <array>
+ <string>0B46C0469E864DFF9A1F22D1</string>
+ </array>
+ <key>isa</key>
+ <string>PBXFrameworksBuildPhase</string>
+ <key>runOnlyForDeploymentPostprocessing</key>
+ <string>0</string>
+ </dict>
+ <key>7EC3317376B64EEDB7472C7D</key>
<dict>
<key>children</key>
<array>
- <string>F45F489E097C47D2B66E1FF7</string>
- <string>F06795170EBA4CD4943F6AD0</string>
- <string>D8875DD727D94EAFAC4FC911</string>
- <string>6A11130C7BD94AF6830157C2</string>
+ <string>D7DEF270C05047A2AA6FFCD1</string>
+ <string>D956DA65E79A4AA3AA1CDEE1</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
+ <key>name</key>
+ <string>Targets Support Files</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
- <key>9447C0AB2D294AD1879FF9EF</key>
+ <key>816160BCBCDC414D9D7B8695</key>
+ <dict>
+ <key>buildConfigurationList</key>
+ <string>F96025ECACC24BFEA1EA27AE</string>
+ <key>buildPhases</key>
+ <array>
+ <string>D715CA140B7044139B309E18</string>
+ <string>85592B182BE240B99CD03B0B</string>
+ <string>78B25303209B469CA78B8BF6</string>
+ </array>
+ <key>buildRules</key>
+ <array/>
+ <key>dependencies</key>
+ <array/>
+ <key>isa</key>
+ <string>PBXNativeTarget</string>
+ <key>name</key>
+ <string>Pods</string>
+ <key>productName</key>
+ <string>Pods</string>
+ <key>productReference</key>
+ <string>C1528FD39C0448EFAFB3C388</string>
+ <key>productType</key>
+ <string>com.apple.product-type.library.static</string>
+ </dict>
+ <key>85592B182BE240B99CD03B0B</key>
<dict>
+ <key>buildActionMask</key>
+ <string>2147483647</string>
+ <key>dstPath</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>dstSubfolderSpec</key>
+ <string>16</string>
+ <key>files</key>
+ <array>
+ <string>B923A0D5009F4800B422CB43</string>
+ </array>
+ <key>isa</key>
+ <string>PBXCopyFilesBuildPhase</string>
+ <key>runOnlyForDeploymentPostprocessing</key>
+ <string>0</string>
+ </dict>
+ <key>8ACDEE465C1F4E2F8849C439</key>
+ <dict>
+ <key>includeInIndex</key>
+ <string>1</string>
+ <key>isa</key>
+ <string>PBXFileReference</string>
+ <key>name</key>
+ <string>Pods-resources.sh</string>
+ <key>path</key>
+ <string>Pods-resources.sh</string>
+ <key>sourceTree</key>
+ <string>SOURCE_ROOT</string>
+ </dict>
+ <key>93F4DDC100F848CF8461D48B</key>
+ <dict>
+ <key>buildSettings</key>
+ <dict/>
+ <key>isa</key>
+ <string>XCBuildConfiguration</string>
+ <key>name</key>
+ <string>Debug</string>
+ </dict>
+ <key>9722425175EC493981F5B3FA</key>
+ <dict>
+ <key>includeInIndex</key>
+ <string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
@@ -355,143 +360,154 @@
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
- <key>A2BDB84D1AB54BBDA0F91C72</key>
+ <key>9CA57A0188324B58886343A9</key>
<dict>
- <key>explicitFileType</key>
- <string>archive.ar</string>
<key>includeInIndex</key>
- <string>0</string>
+ <string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
- <string>libPods.a</string>
+ <string>SVPullToRefresh.h</string>
<key>path</key>
- <string>libPods.a</string>
+ <string>SVPullToRefresh/SVPullToRefresh/SVPullToRefresh.h</string>
<key>sourceTree</key>
- <string>BUILT_PRODUCTS_DIR</string>
+ <string>SOURCE_ROOT</string>
</dict>
- <key>A652C15692A9499985497F43</key>
+ <key>9DCD4587BB074359B8785DA1</key>
<dict>
- <key>fileRef</key>
- <string>387335721F22432198D64721</string>
+ <key>buildSettings</key>
+ <dict/>
<key>isa</key>
- <string>PBXBuildFile</string>
- <key>settings</key>
- <dict>
- <key>COMPILER_FLAGS</key>
- <string> </string>
- </dict>
+ <string>XCBuildConfiguration</string>
+ <key>name</key>
+ <string>Release</string>
</dict>
- <key>B26766EFE91D4819984570D8</key>
+ <key>B8E9B91FEDF6424987053EAB</key>
+ <dict>
+ <key>children</key>
+ <array>
+ <string>67A7CE780A2B449596D77A8F</string>
+ </array>
+ <key>isa</key>
+ <string>PBXGroup</string>
+ <key>name</key>
+ <string>Frameworks</string>
+ <key>sourceTree</key>
+ <string>&lt;group&gt;</string>
+ </dict>
+ <key>B923A0D5009F4800B422CB43</key>
<dict>
<key>fileRef</key>
- <string>7701D76ED7904E09A702AD8E</string>
+ <string>9CA57A0188324B58886343A9</string>
<key>isa</key>
<string>PBXBuildFile</string>
+ <key>settings</key>
+ <dict>
+ <key>ATTRIBUTES</key>
+ <array>
+ <string>Public</string>
+ </array>
+ </dict>
</dict>
- <key>BA1A59FEBD3640B9BAFE68C8</key>
+ <key>C1528FD39C0448EFAFB3C388</key>
<dict>
- <key>buildActionMask</key>
- <string>2147483647</string>
- <key>dstPath</key>
- <string>$(PRODUCT_NAME)</string>
- <key>dstSubfolderSpec</key>
- <string>16</string>
- <key>files</key>
- <array/>
- <key>isa</key>
- <string>PBXCopyFilesBuildPhase</string>
- <key>runOnlyForDeploymentPostprocessing</key>
+ <key>explicitFileType</key>
+ <string>archive.ar</string>
+ <key>includeInIndex</key>
<string>0</string>
+ <key>isa</key>
+ <string>PBXFileReference</string>
+ <key>name</key>
+ <string>libPods.a</string>
+ <key>path</key>
+ <string>libPods.a</string>
+ <key>sourceTree</key>
+ <string>BUILT_PRODUCTS_DIR</string>
</dict>
- <key>C8EDE91C083D4361AAFC3185</key>
+ <key>C9185CAD8CA643CE8C316BD3</key>
<dict>
<key>buildConfigurations</key>
<array>
- <string>6C6592B3566F4735BE06742F</string>
- <string>7603C1A85FD447CC847263F4</string>
+ <string>93F4DDC100F848CF8461D48B</string>
+ <string>9DCD4587BB074359B8785DA1</string>
</array>
+ <key>defaultConfigurationIsVisible</key>
+ <string>0</string>
+ <key>defaultConfigurationName</key>
+ <string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
- <key>CE9262B13B74469BB397BBA5</key>
+ <key>D715CA140B7044139B309E18</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
- <string>A652C15692A9499985497F43</string>
+ <string>FA4673CEF23F4CCBBE38CA96</string>
+ <string>06BAAB6950CF4A8D8B9C23ED</string>
</array>
<key>isa</key>
<string>PBXSourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
- <key>D6758442F68D49D0962452B3</key>
- <dict>
- <key>isa</key>
- <string>PBXFileReference</string>
- <key>lastKnownFileType</key>
- <string>text.xcconfig</string>
- <key>name</key>
- <string>Pods.xcconfig</string>
- <key>path</key>
- <string>Pods.xcconfig</string>
- <key>sourceTree</key>
- <string>SOURCE_ROOT</string>
- </dict>
- <key>D8875DD727D94EAFAC4FC911</key>
+ <key>D7DEF270C05047A2AA6FFCD1</key>
<dict>
<key>children</key>
<array>
- <string>A2BDB84D1AB54BBDA0F91C72</string>
+ <string>8ACDEE465C1F4E2F8849C439</string>
+ <string>9722425175EC493981F5B3FA</string>
+ <string>4D01FCDF06834BDB83D5E813</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
- <string>Products</string>
- <key>sourceTree</key>
- <string>&lt;group&gt;</string>
- </dict>
- <key>F06795170EBA4CD4943F6AD0</key>
- <dict>
- <key>children</key>
- <array>
- <string>7701D76ED7904E09A702AD8E</string>
- </array>
- <key>isa</key>
- <string>PBXGroup</string>
- <key>name</key>
- <string>Frameworks</string>
+ <string>Pods</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
- <key>F1EBDAA4942447AA9FACDF80</key>
+ <key>D956DA65E79A4AA3AA1CDEE1</key>
<dict>
+ <key>includeInIndex</key>
+ <string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
- <string>Pods-resources.sh</string>
+ <string>PodsDummy_Pods.m</string>
<key>path</key>
- <string>Pods-resources.sh</string>
+ <string>PodsDummy_Pods.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
- <key>F45F489E097C47D2B66E1FF7</key>
+ <key>F96025ECACC24BFEA1EA27AE</key>
<dict>
- <key>children</key>
+ <key>buildConfigurations</key>
<array>
- <string>15AEF9939DCE4C38A471397C</string>
+ <string>71C0AC77A0FC4EE39DE4D678</string>
+ <string>6373E7CDD93B4A78AD65FFE9</string>
</array>
+ <key>defaultConfigurationIsVisible</key>
+ <string>0</string>
+ <key>defaultConfigurationName</key>
+ <string>Release</string>
<key>isa</key>
- <string>PBXGroup</string>
- <key>name</key>
- <string>Pods</string>
- <key>sourceTree</key>
- <string>&lt;group&gt;</string>
+ <string>XCConfigurationList</string>
+ </dict>
+ <key>FA4673CEF23F4CCBBE38CA96</key>
+ <dict>
+ <key>fileRef</key>
+ <string>18FB38796B0348B08464B799</string>
+ <key>isa</key>
+ <string>PBXBuildFile</string>
+ <key>settings</key>
+ <dict>
+ <key>COMPILER_FLAGS</key>
+ <string>-fobjc-arc</string>
+ </dict>
</dict>
</dict>
<key>rootObject</key>
- <string>360DE8EB6F914010A962D970</string>
+ <string>16DABB0DDA0F4D40814FDAF0</string>
</dict>
</plist>
View
4 Pods/PodsDummy_Pods.m
@@ -0,0 +1,4 @@
+@interface PodsDummy_Pods : NSObject
+@end
+@implementation PodsDummy_Pods
+@end
View
20 Pods/SVPullToRefresh/.gitignore
@@ -1,20 +0,0 @@
-# Mac OS X
-*.DS_Store
-*.psd
-
-# Xcode
-*.pbxuser
-*.mode1v3
-*.mode2v3
-*.perspectivev3
-*.xcuserstate
-project.xcworkspace/
-xcuserdata/
-
-# Generated files
-build/
-*.[oa]
-*.pyc
-
-# Backup files
-*~.nib
View
79 Pods/SVPullToRefresh/README.textile
@@ -1,6 +1,13 @@
+__*Important note if your project doesn't use ARC*: you must add the @-fobjc-arc@ compiler flag to @SVPullToRefresh.m@ in Target Settings > Build Phases > Compile Sources.__
+
h1. SVPullToRefresh
-SVPullToRefresh allows you to easily add pull-to-refresh functionality to any @UIScrollView@ subclass with only 1 line of code. Instead of depending on delegates and/or subclassing @UIViewController@, SVPullToRefresh extends @UIScrollView@ with a @addPullToRefreshWithActionHandler:@ method as well as a @pullToRefreshView@ property.
+SVPullToRefresh allows you to easily add pull-to-refresh and/or infinite scrolling functionalities to any @UITableView@ subclass with only 1 line of code. Instead of depending on delegates and/or subclassing @UIViewController@, SVPullToRefresh extends @UIScrollView@ with the following 2 methods:
+
+<pre>
+- (void)addPullToRefreshWithActionHandler:(void (^)(void))actionHandler;
+- (void)addInfiniteScrollingWithActionHandler:(void (^)(void))actionHandler;
+</pre>
h2. Installation
@@ -12,7 +19,7 @@ h2. Usage
(see sample Xcode project in @/Demo@)
-Adding pull-to-refresh to a table view can be done with one single line of code:
+h3. Adding pull to refresh to your table view
<pre>
[tableView addPullToRefreshWithActionHandler:^{
@@ -21,9 +28,21 @@ Adding pull-to-refresh to a table view can be done with one single line of code:
}];
</pre>
-h2. Customization
+If you’d like to programmatically trigger the refresh (for instance in viewDidLoad), you can do so with:
+
+<pre>
+[tableView.pullToRefreshView triggerRefresh];
+</pre>
+
+You can temporarily hide/disable pull to refresh by setting the @showsPullToRefresh@ property:
+
+<pre>
+tableView.showsPullToRefresh = NO;
+</pre>
+
+h4. Customization
-The SVPullToRefresh view can be customized with the following properties:
+The @pullToRefreshView@ view can be customized using the following properties:
<pre>
@property (nonatomic, strong) UIColor *arrowColor;
@@ -31,18 +50,64 @@ The SVPullToRefresh view can be customized with the following properties:
@property (nonatomic, readwrite) UIActivityIndicatorViewStyle activityIndicatorViewStyle;
</pre>
-You can access these properties through your scroll view's @pullToRefreshView@ property. For instance, you would set the @arrowColor@ property using:
+You can access these properties through your scroll view's @pullToRefreshView@ property.
+
+For instance, you would set the @arrowColor@ property using:
<pre>
tableView.pullToRefreshView.arrowColor = [UIColor whiteColor];
</pre>
+h4. Showing a "Last Updated" label
+
+If you think it's in the user's interest to display the date of the last refresh, you can set the @lastUpdatedDate@ property of @pullToRefreshView@:
+
+<pre>
+tableView.pullToRefreshView.lastUpdatedDate = nil; // will display "Last Updated: Never"
+tableView.pullToRefreshView.lastUpdatedDate = [NSDate date]; // will display "Last Updated: 4/30/12 11:53 AM"
+</pre>
+
+You can also configure how the date is displayed by setting the @dateFormatter@ property:
+
+<pre>
+NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+dateFormatter.dateStyle = NSDateFormatterLongStyle;
+dateFormatter.timeStyle = NSDateFormatterNoStyle;
+tableView.pullToRefreshView.dateFormatter = dateFormatter;
+</pre>
+
+h3. Adding infinite scrolling to your table view
+
+<pre>
+[tableView addInfiniteScrollingWithActionHandler:^{
+ // add data to data source, insert new cells into table view
+}];
+</pre>
+
+You can temporarily hide/disable infinite scrolling by setting the @showsInfiniteScrolling@ property:
+
+<pre>
+tableView.showsInfiniteScrolling = NO;
+</pre>
+
+h4. Customization
+
+The @infiniteScrollingView@ (a @UIView@ subclass) can be customized using the following properties:
+
+<pre>
+@property (nonatomic, readwrite) UIActivityIndicatorViewStyle activityIndicatorViewStyle;
+</pre>
+
+You can access these properties through your scroll view's @infiniteScrollingView@ property.
+
h2. Under the hood
-SVPullToRefresh extends @UIScrollView@ by adding a new public method as well as a dynamic property (thanks "@seb_morel":http://twitter.com/seb_morel!). It uses key-value observing to track the scrollView's @contentOffset@, which removes the need for the view to be linked to the @UIScrollViewDelegate@ protocol.
+SVPullToRefresh extends @UIScrollView@ by adding new public methods as well as a dynamic properties (thanks "@seb_morel":http://twitter.com/seb_morel!). It uses key-value observing to track the scrollView's @contentOffset@, which removes the need for the view to be linked to the @UIScrollViewDelegate@ protocol.
h2. Credits
SVPullToRefresh is brought to you by "Sam Vermette":http://samvermette.com and "contributors to the project":https://github.com/samvermette/SVPullToRefresh/contributors. If you have feature suggestions or bug reports, feel free to help out by sending pull requests or by "creating new issues":https://github.com/samvermette/SVPullToRefresh/issues/new. If you're using SVPullToRefresh in your project, attribution would be nice.
-Big thanks to "@seb_morel":http://twitter.com/seb_morel for his "Demistifying the Objective-C runtime":http://cocoaheadsmtl.s3.amazonaws.com/demistifying-runtime.pdf which permitted the high abstraction of this class.
+Big thanks to "@seb_morel":http://twitter.com/seb_morel for his "Demistifying the Objective-C runtime":http://cocoaheadsmtl.s3.amazonaws.com/demistifying-runtime.pdf talk, which permitted the level of abstraction found in SVPullToRefresh.
+
+Hat tip to "Loren Brichter":http://twitter.com/lorenb for inventing such a great UI mechanism.
View
BIN  Pods/SVPullToRefresh/SVPullToRefresh/SVPullToRefresh.bundle/arrow.png
Deleted file not rendered
View
BIN  Pods/SVPullToRefresh/SVPullToRefresh/SVPullToRefresh.bundle/arrow@2x.png
Deleted file not rendered
View
9 Pods/SVPullToRefresh/SVPullToRefresh/SVPullToRefresh.h
@@ -15,6 +15,10 @@
@property (nonatomic, strong) UIColor *textColor;
@property (nonatomic, readwrite) UIActivityIndicatorViewStyle activityIndicatorViewStyle;
+@property (nonatomic, strong) NSDate *lastUpdatedDate;
+@property (nonatomic, strong) NSDateFormatter *dateFormatter;
+
+- (void)triggerRefresh;
- (void)stopAnimating;
@end
@@ -25,7 +29,12 @@
@interface UIScrollView (SVPullToRefresh)
- (void)addPullToRefreshWithActionHandler:(void (^)(void))actionHandler;
+- (void)addInfiniteScrollingWithActionHandler:(void (^)(void))actionHandler;
@property (nonatomic, strong) SVPullToRefresh *pullToRefreshView;
+@property (nonatomic, strong) SVPullToRefresh *infiniteScrollingView;
+
+@property (nonatomic, assign) BOOL showsPullToRefresh;
+@property (nonatomic, assign) BOOL showsInfiniteScrolling;
@end
View
457 Pods/SVPullToRefresh/SVPullToRefresh/SVPullToRefresh.m
@@ -19,6 +19,10 @@
typedef NSUInteger SVPullToRefreshState;
+@interface SVPullToRefreshArrow : UIView
+@property (nonatomic, strong) UIColor *arrowColor;
+@end
+
@interface SVPullToRefresh ()
@@ -27,106 +31,184 @@ - (void)rotateArrow:(float)degrees hide:(BOOL)hide;
- (void)setScrollViewContentInset:(UIEdgeInsets)contentInset;
- (void)scrollViewDidScroll:(CGPoint)contentOffset;
-@property (nonatomic, copy) void (^actionHandler)(void);
+- (void)startObservingScrollView;
+- (void)stopObservingScrollView;
+
+@property (nonatomic, copy) void (^pullToRefreshActionHandler)(void);
+@property (nonatomic, copy) void (^infiniteScrollingActionHandler)(void);
@property (nonatomic, readwrite) SVPullToRefreshState state;
-@property (nonatomic, strong) UIImageView *arrow;
-@property (nonatomic, strong, readonly) UIImage *arrowImage;
+@property (nonatomic, strong) SVPullToRefreshArrow *arrow;
@property (nonatomic, strong) UIActivityIndicatorView *activityIndicatorView;
@property (nonatomic, strong) UILabel *titleLabel;
-@property (nonatomic, strong) UIScrollView *scrollView;
+@property (nonatomic, strong, readonly) UILabel *dateLabel;
+
+@property (nonatomic, unsafe_unretained) UIScrollView *scrollView;
@property (nonatomic, readwrite) UIEdgeInsets originalScrollViewContentInset;
+@property (nonatomic, strong) UIView *originalTableFooterView;
+
+@property (nonatomic, assign) BOOL showsPullToRefresh;
+@property (nonatomic, assign) BOOL showsInfiniteScrolling;
+@property (nonatomic, assign) BOOL isObservingScrollView;
@end
+
@implementation SVPullToRefresh
// public properties
-@synthesize actionHandler, arrowColor, textColor, activityIndicatorViewStyle;
+@synthesize pullToRefreshActionHandler, infiniteScrollingActionHandler, arrowColor, textColor, activityIndicatorViewStyle, lastUpdatedDate, dateFormatter;
@synthesize state;
@synthesize scrollView = _scrollView;
-@synthesize arrow, arrowImage, activityIndicatorView, titleLabel, originalScrollViewContentInset;
+@synthesize arrow, activityIndicatorView, titleLabel, dateLabel, originalScrollViewContentInset, originalTableFooterView, showsPullToRefresh, showsInfiniteScrolling, isObservingScrollView;
+
+- (void)dealloc {
+ [self stopObservingScrollView];
+}
- (id)initWithScrollView:(UIScrollView *)scrollView {
self = [super initWithFrame:CGRectZero];
self.scrollView = scrollView;
- [_scrollView addSubview:self];
-
- self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(ceil(self.superview.bounds.size.width*0.21+44), 20, 150, 20)];
- titleLabel.text = NSLocalizedString(@"Pull to refresh...",);
- titleLabel.font = [UIFont boldSystemFontOfSize:14];
- titleLabel.backgroundColor = [UIColor clearColor];
- [self addSubview:titleLabel];
// default styling values
- self.arrowColor = [UIColor grayColor];
self.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
- self.titleLabel.textColor = [UIColor darkGrayColor];
+ self.textColor = [UIColor darkGrayColor];
- [self addSubview:self.arrow];
-
- [scrollView addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionNew context:nil];
- self.originalScrollViewContentInset = scrollView.contentInset;
-
- self.state = SVPullToRefreshStateHidden;
- self.frame = CGRectMake(0, -60, scrollView.bounds.size.width, 60);
+ self.originalScrollViewContentInset = self.scrollView.contentInset;
return self;
}
+- (void)willMoveToSuperview:(UIView *)newSuperview {
+ if(newSuperview == self.scrollView)
+ [self startObservingScrollView];
+ else if(newSuperview == nil)
+ [self stopObservingScrollView];
+}
+
+- (void)layoutSubviews {
+ CGFloat remainingWidth = self.superview.bounds.size.width-200;
+ float position = 0.50;
+
+ CGRect titleFrame = titleLabel.frame;
+ titleFrame.origin.x = ceil(remainingWidth*position+44);
+ titleLabel.frame = titleFrame;
+
+ CGRect dateFrame = dateLabel.frame;
+ dateFrame.origin.x = titleFrame.origin.x;
+ dateLabel.frame = dateFrame;
+
+ CGRect arrowFrame = arrow.frame;
+ arrowFrame.origin.x = ceil(remainingWidth*position);
+ arrow.frame = arrowFrame;
+
+ if(infiniteScrollingActionHandler) {
+ self.activityIndicatorView.center = CGPointMake(round(self.bounds.size.width/2), round(self.bounds.size.height/2));
+ } else
+ self.activityIndicatorView.center = self.arrow.center;
+
+}
#pragma mark - Getters
-- (UIImageView *)arrow {
- if(!arrow) {
- arrow = [[UIImageView alloc] initWithImage:self.arrowImage];
- arrow.frame = CGRectMake(ceil(self.superview.bounds.size.width*0.21), 6, 22, 48);
+- (SVPullToRefreshArrow *)arrow {
+ if(!arrow && pullToRefreshActionHandler) {
+ arrow = [SVPullToRefreshArrow new];
+ arrow.frame = CGRectMake(0, 6, 22, 48);
arrow.backgroundColor = [UIColor clearColor];
+
+ // assign a different default color for arrow
+// arrow.arrowColor = [UIColor blueColor];
}
return arrow;
}
-- (UIImage *)arrowImage {
- CGRect rect = CGRectMake(0, 0, 22, 48);
- UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0);
-
- CGContextRef context = UIGraphicsGetCurrentContext();
- [[UIColor clearColor] set];
- CGContextFillRect(context, rect);
-
- [self.arrowColor set];
- CGContextTranslateCTM(context, 0, rect.size.height);
- CGContextScaleCTM(context, 1.0, -1.0);
- CGContextClipToMask(context, rect, [[UIImage imageNamed:@"SVPullToRefresh.bundle/arrow"] CGImage]);
- CGContextFillRect(context, rect);
-
- UIImage *output = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- return output;
-}
-
- (UIActivityIndicatorView *)activityIndicatorView {
if(!activityIndicatorView) {
activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
activityIndicatorView.hidesWhenStopped = YES;
[self addSubview:activityIndicatorView];
- self.activityIndicatorView.center = self.arrow.center;
}
return activityIndicatorView;
}
+- (UILabel *)dateLabel {
+ if(!dateLabel && pullToRefreshActionHandler) {
+ dateLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 28, 180, 20)];
+ dateLabel.font = [UIFont systemFontOfSize:12];
+ dateLabel.backgroundColor = [UIColor clearColor];
+ dateLabel.textColor = textColor;
+ [self addSubview:dateLabel];
+
+ CGRect titleFrame = titleLabel.frame;
+ titleFrame.origin.y = 12;
+ titleLabel.frame = titleFrame;
+ }
+ return dateLabel;
+}
+
+- (NSDateFormatter *)dateFormatter {
+ if(!dateFormatter) {
+ dateFormatter = [[NSDateFormatter alloc] init];
+ [dateFormatter setDateStyle:NSDateFormatterShortStyle];
+ [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
+ dateFormatter.locale = [NSLocale currentLocale];
+ }
+ return dateFormatter;
+}
+
+- (UIEdgeInsets)originalScrollViewContentInset {
+ return UIEdgeInsetsMake(originalScrollViewContentInset.top, self.scrollView.contentInset.left, self.scrollView.contentInset.bottom, self.scrollView.contentInset.right);
+}
+
#pragma mark - Setters
+- (void)setPullToRefreshActionHandler:(void (^)(void))actionHandler {
+ pullToRefreshActionHandler = [actionHandler copy];
+ [_scrollView addSubview:self];
+ self.showsPullToRefresh = YES;
+
+ self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, 150, 20)];
+ titleLabel.text = NSLocalizedString(@"Pull to refresh...",);
+ titleLabel.font = [UIFont boldSystemFontOfSize:14];
+ titleLabel.backgroundColor = [UIColor clearColor];
+ titleLabel.textColor = textColor;
+ [self addSubview:titleLabel];
+
+ [self addSubview:self.arrow];
+
+ self.state = SVPullToRefreshStateHidden;
+ self.frame = CGRectMake(0, -60, self.scrollView.bounds.size.width, 60);
+}
+
+- (void)setInfiniteScrollingActionHandler:(void (^)(void))actionHandler {
+ infiniteScrollingActionHandler = [actionHandler copy];
+ self.showsInfiniteScrolling = YES;
+
+ self.frame = CGRectMake(0, 0, self.scrollView.bounds.size.width, 60);
+ self.originalTableFooterView = [(UITableView*)self.scrollView tableFooterView];
+ [(UITableView*)self.scrollView setTableFooterView:self];
+
+ self.state = SVPullToRefreshStateHidden;
+ [self layoutSubviews];
+}
+
- (void)setArrowColor:(UIColor *)newArrowColor {
- arrowColor = newArrowColor;
- self.arrow.image = self.arrowImage;
+ self.arrow.arrowColor = newArrowColor; // pass through
+ [self.arrow setNeedsDisplay];
+}
+
+- (UIColor *)arrowColor {
+ return self.arrow.arrowColor; // pass through
}
- (void)setTextColor:(UIColor *)newTextColor {
- self.titleLabel.textColor = newTextColor;
+ textColor = newTextColor;
+ titleLabel.textColor = newTextColor;
+ dateLabel.textColor = newTextColor;
}
- (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)viewStyle {
@@ -136,28 +218,90 @@ - (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)viewStyle {
- (void)setScrollViewContentInset:(UIEdgeInsets)contentInset {
[UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionAllowUserInteraction|UIViewAnimationOptionBeginFromCurrentState animations:^{
self.scrollView.contentInset = contentInset;
- } completion:NULL];
+ } completion:^(BOOL finished) {
+ if(self.state == SVPullToRefreshStateHidden && contentInset.top == self.originalScrollViewContentInset.top)
+ [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{
+ arrow.alpha = 0;
+ } completion:NULL];
+ }];
+}
+
+- (void)setLastUpdatedDate:(NSDate *)newLastUpdatedDate {
+ self.dateLabel.text = [NSString stringWithFormat:NSLocalizedString(@"Last Updated: %@",), newLastUpdatedDate?[self.dateFormatter stringFromDate:newLastUpdatedDate]:NSLocalizedString(@"Never",)];
+}
+
+- (void)setDateFormatter:(NSDateFormatter *)newDateFormatter {
+ dateFormatter = newDateFormatter;
+ self.dateLabel.text = [NSString stringWithFormat:NSLocalizedString(@"Last Updated: %@",), self.lastUpdatedDate?[newDateFormatter stringFromDate:self.lastUpdatedDate]:NSLocalizedString(@"Never",)];
}
+- (void)setShowsInfiniteScrolling:(BOOL)show {
+ showsInfiniteScrolling = show;
+ if(!show)
+ [(UITableView*)self.scrollView setTableFooterView:self.originalTableFooterView];
+ else
+ [(UITableView*)self.scrollView setTableFooterView:self];
+}
#pragma mark -
+- (void)startObservingScrollView {
+ if (self.isObservingScrollView)
+ return;
+
+ [self.scrollView addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionNew context:nil];
+ [self.scrollView addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew context:nil];
+ self.isObservingScrollView = YES;
+}
+
+- (void)stopObservingScrollView {
+ if(!self.isObservingScrollView)
+ return;
+
+ [self.scrollView removeObserver:self forKeyPath:@"contentOffset"];
+ [self.scrollView removeObserver:self forKeyPath:@"frame"];
+ self.isObservingScrollView = NO;
+}
+
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if([keyPath isEqualToString:@"contentOffset"])
[self scrollViewDidScroll:[[change valueForKey:NSKeyValueChangeNewKey] CGPointValue]];
+ else if([keyPath isEqualToString:@"frame"])
+ [self layoutSubviews];
}
- (void)scrollViewDidScroll:(CGPoint)contentOffset {
- CGFloat scrollOffsetThreshold = self.frame.origin.y-self.originalScrollViewContentInset.top;
-
- if(!self.scrollView.isDragging && self.state == SVPullToRefreshStateTriggered)
- self.state = SVPullToRefreshStateLoading;
- else if(contentOffset.y > scrollOffsetThreshold && contentOffset.y < -self.originalScrollViewContentInset.top && self.scrollView.isDragging && self.state != SVPullToRefreshStateLoading)
- self.state = SVPullToRefreshStateVisible;
- else if(contentOffset.y < scrollOffsetThreshold && self.scrollView.isDragging && self.state == SVPullToRefreshStateVisible)
- self.state = SVPullToRefreshStateTriggered;
- else if(contentOffset.y >= -self.originalScrollViewContentInset.top && self.state != SVPullToRefreshStateHidden)
- self.state = SVPullToRefreshStateHidden;
+ if(pullToRefreshActionHandler) {
+ if (self.state == SVPullToRefreshStateLoading) {
+ CGFloat offset = MAX(self.scrollView.contentOffset.y * -1, 0);
+ offset = MIN(offset, 60.0f);
+ self.scrollView.contentInset = UIEdgeInsetsMake(offset, 0.0f, 0.0f, 0.0f);
+ } else {
+ CGFloat scrollOffsetThreshold = self.frame.origin.y-self.originalScrollViewContentInset.top;
+
+ if(!self.scrollView.isDragging && self.state == SVPullToRefreshStateTriggered)
+ self.state = SVPullToRefreshStateLoading;
+ else if(contentOffset.y > scrollOffsetThreshold && contentOffset.y < -self.originalScrollViewContentInset.top && self.scrollView.isDragging && self.state != SVPullToRefreshStateLoading)
+ self.state = SVPullToRefreshStateVisible;