Skip to content

Commit d29da06

Browse files
committed
fix bug of refreshControl
1 parent 6062437 commit d29da06

File tree

3 files changed

+117
-8
lines changed

3 files changed

+117
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0460"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "ABC1C8B115AAD33E0033ECF0"
18+
BuildableName = "iOS6InfiniteScrolling.app"
19+
BlueprintName = "iOS6InfiniteScrolling"
20+
ReferencedContainer = "container:iOS6InfiniteScrolling.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
27+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
28+
shouldUseLaunchSchemeArgsEnv = "YES"
29+
buildConfiguration = "Debug">
30+
<Testables>
31+
</Testables>
32+
<MacroExpansion>
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "ABC1C8B115AAD33E0033ECF0"
36+
BuildableName = "iOS6InfiniteScrolling.app"
37+
BlueprintName = "iOS6InfiniteScrolling"
38+
ReferencedContainer = "container:iOS6InfiniteScrolling.xcodeproj">
39+
</BuildableReference>
40+
</MacroExpansion>
41+
</TestAction>
42+
<LaunchAction
43+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
44+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
45+
launchStyle = "0"
46+
useCustomWorkingDirectory = "NO"
47+
buildConfiguration = "Debug"
48+
ignoresPersistentStateOnLaunch = "NO"
49+
debugDocumentVersioning = "YES"
50+
allowLocationSimulation = "YES">
51+
<BuildableProductRunnable>
52+
<BuildableReference
53+
BuildableIdentifier = "primary"
54+
BlueprintIdentifier = "ABC1C8B115AAD33E0033ECF0"
55+
BuildableName = "iOS6InfiniteScrolling.app"
56+
BlueprintName = "iOS6InfiniteScrolling"
57+
ReferencedContainer = "container:iOS6InfiniteScrolling.xcodeproj">
58+
</BuildableReference>
59+
</BuildableProductRunnable>
60+
<AdditionalOptions>
61+
</AdditionalOptions>
62+
</LaunchAction>
63+
<ProfileAction
64+
shouldUseLaunchSchemeArgsEnv = "YES"
65+
savedToolIdentifier = ""
66+
useCustomWorkingDirectory = "NO"
67+
buildConfiguration = "Release"
68+
debugDocumentVersioning = "YES">
69+
<BuildableProductRunnable>
70+
<BuildableReference
71+
BuildableIdentifier = "primary"
72+
BlueprintIdentifier = "ABC1C8B115AAD33E0033ECF0"
73+
BuildableName = "iOS6InfiniteScrolling.app"
74+
BlueprintName = "iOS6InfiniteScrolling"
75+
ReferencedContainer = "container:iOS6InfiniteScrolling.xcodeproj">
76+
</BuildableReference>
77+
</BuildableProductRunnable>
78+
</ProfileAction>
79+
<AnalyzeAction
80+
buildConfiguration = "Debug">
81+
</AnalyzeAction>
82+
<ArchiveAction
83+
buildConfiguration = "Release"
84+
revealArchiveInOrganizer = "YES">
85+
</ArchiveAction>
86+
</Scheme>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SchemeUserState</key>
6+
<dict>
7+
<key>iOS6InfiniteScrolling.xcscheme</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
<key>SuppressBuildableAutocreation</key>
14+
<dict>
15+
<key>ABC1C8B115AAD33E0033ECF0</key>
16+
<dict>
17+
<key>primary</key>
18+
<true/>
19+
</dict>
20+
</dict>
21+
</dict>
22+
</plist>

ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/PullToRefreshViewController.m

+9-8
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ - (void)viewDidLoad
5959

6060
self.loading = NO;
6161

62-
// if(NSClassFromString(@"UIRefreshControl")) {
63-
//
64-
// self.refreshControl = [[UIRefreshControl alloc] init];
65-
// [self.refreshControl addTarget:self action:@selector(refreshedByPullingTable:) forControlEvents:UIControlEventValueChanged];
66-
// }
67-
// else
62+
if(NSClassFromString(@"UIRefreshControl")) {
63+
64+
self.refreshControl = [[UIRefreshControl alloc] init];
65+
[self.refreshControl addTarget:self action:@selector(refreshedByPullingTable:) forControlEvents:UIControlEventValueChanged];
66+
}
67+
else
6868
{
6969

7070
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)];
@@ -78,7 +78,7 @@ - (void)viewDidLoad
7878
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
7979
{
8080
if(self.searchDisplayController.searchResultsTableView == scrollView) return;
81-
81+
if(NSClassFromString(@"UIRefreshControl")) return;
8282
if (self.refreshHeaderView.state == EGOOPullRefreshLoading) {
8383
CGFloat offset = MAX(scrollView.contentOffset.y * -1, 0);
8484
offset = MIN(offset, 60);
@@ -99,7 +99,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
9999
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
100100
{
101101
if(self.searchDisplayController.searchResultsTableView == scrollView) return;
102-
102+
if(NSClassFromString(@"UIRefreshControl")) return;
103103
if (scrollView.contentOffset.y <= - 65.0f && !self.loading) {
104104
self.loading = YES;
105105

@@ -138,6 +138,7 @@ -(void) loadMore {
138138

139139
-(void) setLoading:(BOOL)loading
140140
{
141+
if(NSClassFromString(@"UIRefreshControl")) return;
141142
_loading = loading;
142143

143144
[UIView beginAnimations:nil context:NULL];

0 commit comments

Comments
 (0)