diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..9254c0b
Binary files /dev/null and b/.DS_Store differ
diff --git a/ch11/.DS_Store b/ch11/.DS_Store
new file mode 100644
index 0000000..6a16efd
Binary files /dev/null and b/ch11/.DS_Store differ
diff --git a/ch11/InfiniteScrollingExample/.DS_Store b/ch11/InfiniteScrollingExample/.DS_Store
new file mode 100644
index 0000000..bec0a76
Binary files /dev/null and b/ch11/InfiniteScrollingExample/.DS_Store differ
diff --git a/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/cokecoffe.xcuserdatad/xcschemes/iOS6InfiniteScrolling.xcscheme b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/cokecoffe.xcuserdatad/xcschemes/iOS6InfiniteScrolling.xcscheme
new file mode 100644
index 0000000..b2143ca
--- /dev/null
+++ b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/cokecoffe.xcuserdatad/xcschemes/iOS6InfiniteScrolling.xcscheme
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/cokecoffe.xcuserdatad/xcschemes/xcschememanagement.plist b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/cokecoffe.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..bba7c33
--- /dev/null
+++ b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/cokecoffe.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,22 @@
+
+
+
+
+ SchemeUserState
+
+ iOS6InfiniteScrolling.xcscheme
+
+ orderHint
+ 0
+
+
+ SuppressBuildableAutocreation
+
+ ABC1C8B115AAD33E0033ECF0
+
+ primary
+
+
+
+
+
diff --git a/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
new file mode 100644
index 0000000..05301bc
--- /dev/null
+++ b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
@@ -0,0 +1,5 @@
+
+
+
diff --git a/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcschemes/iOS6InfiniteScrolling.xcscheme b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcschemes/iOS6InfiniteScrolling.xcscheme
new file mode 100644
index 0000000..b2143ca
--- /dev/null
+++ b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcschemes/iOS6InfiniteScrolling.xcscheme
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcschemes/xcschememanagement.plist b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..bba7c33
--- /dev/null
+++ b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,22 @@
+
+
+
+
+ SchemeUserState
+
+ iOS6InfiniteScrolling.xcscheme
+
+ orderHint
+ 0
+
+
+ SuppressBuildableAutocreation
+
+ ABC1C8B115AAD33E0033ECF0
+
+ primary
+
+
+
+
+
diff --git a/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/MasterViewController.m b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/MasterViewController.m
index 667a21c..b3482d8 100644
--- a/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/MasterViewController.m
+++ b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/MasterViewController.m
@@ -41,7 +41,7 @@ -(void) doRefresh {
double delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
- self.loading = NO;
+ self.loading = NO;
});
}
diff --git a/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/PullToRefreshViewController.m b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/PullToRefreshViewController.m
index 583259b..c898e67 100755
--- a/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/PullToRefreshViewController.m
+++ b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/PullToRefreshViewController.m
@@ -63,7 +63,9 @@ - (void)viewDidLoad
self.refreshControl = [[UIRefreshControl alloc] init];
[self.refreshControl addTarget:self action:@selector(refreshedByPullingTable:) forControlEvents:UIControlEventValueChanged];
- } else {
+ }
+ else
+ {
self.refreshHeaderView = [[EGORefreshTableHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f - self.tableView.bounds.size.height, self.tableView.bounds.size.width, self.tableView.bounds.size.height)];
@@ -76,7 +78,7 @@ - (void)viewDidLoad
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if(self.searchDisplayController.searchResultsTableView == scrollView) return;
-
+ if(NSClassFromString(@"UIRefreshControl")) return;
if (self.refreshHeaderView.state == EGOOPullRefreshLoading) {
CGFloat offset = MAX(scrollView.contentOffset.y * -1, 0);
offset = MIN(offset, 60);
@@ -97,7 +99,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
if(self.searchDisplayController.searchResultsTableView == scrollView) return;
-
+ if(NSClassFromString(@"UIRefreshControl")) return;
if (scrollView.contentOffset.y <= - 65.0f && !self.loading) {
self.loading = YES;
@@ -136,6 +138,7 @@ -(void) loadMore {
-(void) setLoading:(BOOL)loading
{
+ if(NSClassFromString(@"UIRefreshControl")) return;
_loading = loading;
[UIView beginAnimations:nil context:NULL];
@@ -175,18 +178,22 @@ -(UITableViewCell*) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS
if(indexPath.section == self.numberOfSections) {
- static NSString *CellIdentifier = @"LoadingCell";
-
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
- if (cell == nil)
- {
- cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
- UIActivityIndicatorView *newSpin = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
- [newSpin startAnimating];
- [newSpin setFrame:CGRectMake( 15, 12, 20, 20) ];
- [cell addSubview:newSpin];
- }
-
+ static NSString *CellIdentifier = @"LoadingCell";
+
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+ if (cell == nil)
+ {
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
+ UIActivityIndicatorView *newSpin = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
+ [newSpin startAnimating];
+ [newSpin setFrame:CGRectMake( 15, 12, 20, 20) ];
+ [newSpin setTag:101];
+ [cell addSubview:newSpin];
+ }
+
+ [(UIActivityIndicatorView *)[cell viewWithTag:101] startAnimating];
+
+
cell.textLabel.text = NSLocalizedString(@"Loading…", @"");
cell.textLabel.textColor = [UIColor colorWithRed:0 green:0 blue:0.5 alpha:1.0];
cell.textLabel.textAlignment = NSTextAlignmentCenter;
diff --git a/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/en.lproj/MainStoryboard.storyboard b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/en.lproj/MainStoryboard.storyboard
index 9cf339e..c837b11 100644
--- a/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/en.lproj/MainStoryboard.storyboard
+++ b/ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/en.lproj/MainStoryboard.storyboard
@@ -1,7 +1,7 @@
-
+
-
+
@@ -47,17 +47,9 @@
-
+
-
-
-
-
-
-
-
-
diff --git a/ch11/PullToRefreshExample/.DS_Store b/ch11/PullToRefreshExample/.DS_Store
new file mode 100644
index 0000000..04f076b
Binary files /dev/null and b/ch11/PullToRefreshExample/.DS_Store differ
diff --git a/ch11/PullToRefreshExample/iOS6PullToRefresh.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/ch11/PullToRefreshExample/iOS6PullToRefresh.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
new file mode 100644
index 0000000..05301bc
--- /dev/null
+++ b/ch11/PullToRefreshExample/iOS6PullToRefresh.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
@@ -0,0 +1,5 @@
+
+
+
diff --git a/ch11/PullToRefreshExample/iOS6PullToRefresh.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcschemes/iOS6PullToRefresh.xcscheme b/ch11/PullToRefreshExample/iOS6PullToRefresh.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcschemes/iOS6PullToRefresh.xcscheme
new file mode 100644
index 0000000..5358e85
--- /dev/null
+++ b/ch11/PullToRefreshExample/iOS6PullToRefresh.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcschemes/iOS6PullToRefresh.xcscheme
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ch11/PullToRefreshExample/iOS6PullToRefresh.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcschemes/xcschememanagement.plist b/ch11/PullToRefreshExample/iOS6PullToRefresh.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..3ef8110
--- /dev/null
+++ b/ch11/PullToRefreshExample/iOS6PullToRefresh.xcodeproj/xcuserdata/wangkeke.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,22 @@
+
+
+
+
+ SchemeUserState
+
+ iOS6PullToRefresh.xcscheme
+
+ orderHint
+ 0
+
+
+ SuppressBuildableAutocreation
+
+ ABC1C8B115AAD33E0033ECF0
+
+ primary
+
+
+
+
+