Skip to content

Commit d80a049

Browse files
committed
Moved the initialPageIndex retrieval to the reloadData method.
1 parent 284b5af commit d80a049

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

SCPageViewController.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'SCPageViewController'
3-
s.version = '2.0.12'
3+
s.version = '2.0.13'
44
s.platform = :ios
55
s.ios.deployment_target = '6.0'
66

SCPageViewController/SCPageViewController.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@ - (void)viewDidLoad
129129

130130
[self.view addSubview:scrollViewWrapper];
131131

132-
if([self.dataSource respondsToSelector:@selector(initialPageInPageViewController:)]) {
133-
self.initialPageIndex = @([self.dataSource initialPageInPageViewController:self]);
134-
self.currentPage = self.initialPageIndex.unsignedIntegerValue;
135-
}
136-
137132
[self reloadData];
138133
}
139134

@@ -234,6 +229,11 @@ - (void)setLayouter:(id<SCPageLayouterProtocol>)layouter
234229

235230
- (void)reloadData
236231
{
232+
if([self.dataSource respondsToSelector:@selector(initialPageInPageViewController:)]) {
233+
self.initialPageIndex = @([self.dataSource initialPageInPageViewController:self]);
234+
self.currentPage = self.initialPageIndex.unsignedIntegerValue;
235+
}
236+
237237
[self.pages enumerateObjectsUsingBlock:^(id obj, NSUInteger pageIndex, BOOL *stop) {
238238
[self _removePageAtIndex:pageIndex];
239239
}];

0 commit comments

Comments
 (0)