Skip to content

Commit 6062437

Browse files
committed
fix bug of loadmore
1 parent 26a606c commit 6062437

File tree

13 files changed

+253
-29
lines changed

13 files changed

+253
-29
lines changed

.DS_Store

6 KB
Binary file not shown.

ch11/.DS_Store

6 KB
Binary file not shown.
6 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Bucket
3+
type = "1"
4+
version = "1.0">
5+
</Bucket>
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/MasterViewController.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ -(void) doRefresh {
4141
double delayInSeconds = 2.0;
4242
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
4343
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
44-
self.loading = NO;
44+
self.loading = NO;
4545
});
4646
}
4747

ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/PullToRefreshViewController.m

+23-17
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ - (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-
} 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
68+
{
6769

6870
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)];
6971

@@ -175,18 +177,22 @@ -(UITableViewCell*) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS
175177

176178
if(indexPath.section == self.numberOfSections) {
177179

178-
static NSString *CellIdentifier = @"LoadingCell";
179-
180-
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
181-
if (cell == nil)
182-
{
183-
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
184-
UIActivityIndicatorView *newSpin = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
185-
[newSpin startAnimating];
186-
[newSpin setFrame:CGRectMake( 15, 12, 20, 20) ];
187-
[cell addSubview:newSpin];
188-
}
189-
180+
static NSString *CellIdentifier = @"LoadingCell";
181+
182+
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
183+
if (cell == nil)
184+
{
185+
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
186+
UIActivityIndicatorView *newSpin = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
187+
[newSpin startAnimating];
188+
[newSpin setFrame:CGRectMake( 15, 12, 20, 20) ];
189+
[newSpin setTag:101];
190+
[cell addSubview:newSpin];
191+
}
192+
193+
[(UIActivityIndicatorView *)[cell viewWithTag:101] startAnimating];
194+
195+
190196
cell.textLabel.text = NSLocalizedString(@"Loading…", @"");
191197
cell.textLabel.textColor = [UIColor colorWithRed:0 green:0 blue:0.5 alpha:1.0];
192198
cell.textLabel.textAlignment = NSTextAlignmentCenter;

ch11/InfiniteScrollingExample/iOS6InfiniteScrolling/en.lproj/MainStoryboard.storyboard

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2809" systemVersion="11E53" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="3">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="3084" systemVersion="12D78" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="3">
33
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1884"/>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="2083"/>
55
</dependencies>
66
<scenes>
77
<!--Navigation Controller-->
@@ -47,17 +47,9 @@
4747
</tableViewController>
4848
<placeholder placeholderIdentifier="IBFirstResponder" id="KL4-lq-2um" userLabel="First Responder" sceneMemberID="firstResponder"/>
4949
</objects>
50-
<point key="canvasLocation" x="668" y="129"/>
50+
<point key="canvasLocation" x="395" y="64"/>
5151
</scene>
5252
</scenes>
53-
<classes>
54-
<class className="MasterViewController" superclassName="PullToRefreshViewController">
55-
<source key="sourceIdentifier" type="project" relativePath="./Classes/MasterViewController.h"/>
56-
</class>
57-
<class className="PullToRefreshViewController" superclassName="UITableViewController">
58-
<source key="sourceIdentifier" type="project" relativePath="./Classes/PullToRefreshViewController.h"/>
59-
</class>
60-
</classes>
6153
<simulatedMetricsContainer key="defaultSimulatedMetrics">
6254
<simulatedStatusBarMetrics key="statusBar"/>
6355
<simulatedOrientationMetrics key="orientation"/>

ch11/PullToRefreshExample/.DS_Store

6 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Bucket
3+
type = "1"
4+
version = "1.0">
5+
</Bucket>
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 = "iOS6PullToRefresh.app"
19+
BlueprintName = "iOS6PullToRefresh"
20+
ReferencedContainer = "container:iOS6PullToRefresh.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 = "iOS6PullToRefresh.app"
37+
BlueprintName = "iOS6PullToRefresh"
38+
ReferencedContainer = "container:iOS6PullToRefresh.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 = "iOS6PullToRefresh.app"
56+
BlueprintName = "iOS6PullToRefresh"
57+
ReferencedContainer = "container:iOS6PullToRefresh.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 = "iOS6PullToRefresh.app"
74+
BlueprintName = "iOS6PullToRefresh"
75+
ReferencedContainer = "container:iOS6PullToRefresh.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>iOS6PullToRefresh.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>

0 commit comments

Comments
 (0)