Skip to content

Commit

Permalink
PageControl actions will scroll to the right page (Thank to Mazen Wadea)
Browse files Browse the repository at this point in the history
  • Loading branch information
icepat committed Aug 23, 2013
1 parent f20f4e5 commit 75a5d68
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
Binary file not shown.
11 changes: 11 additions & 0 deletions ICETutorial/Libraries/ICETutorialController.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ - (IBAction)didClickOnButton2:(id)sender{
_button2Block(sender);
}

- (IBAction)didClickOnPageControl:(UIPageControl *)sender {
_currentState = ScrollingStateManual;

// Make the scrollView animation.
[_scrollView setContentOffset:CGPointMake(sender.currentPage * _windowSize.width,0)
animated:YES];

// Set the PageControl on the right page.
[_pageControl setCurrentPage:sender.currentPage];
}

#pragma mark - Pages
// Set the list of pages (ICETutorialPage)
- (void)setPages:(NSArray *)pages{
Expand Down
11 changes: 10 additions & 1 deletion ICETutorial/en.lproj/ICETutorialController_iPad.xib
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,15 @@
</object>
<int key="connectionID">173</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">didClickOnPageControl:</string>
<reference key="source" ref="331724563"/>
<reference key="destination" ref="841351856"/>
<int key="IBEventType">13</int>
</object>
<int key="connectionID">236</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">didClickOnButton2:</string>
Expand Down Expand Up @@ -1027,7 +1036,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">235</int>
<int key="maxID">236</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand Down
16 changes: 15 additions & 1 deletion ICETutorial/en.lproj/ICETutorialController_iPhone.xib
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,15 @@
</object>
<int key="connectionID">257</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">didClickOnPageControl:</string>
<reference key="source" ref="805740042"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">13</int>
</object>
<int key="connectionID">295</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
Expand Down Expand Up @@ -972,7 +981,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">294</int>
<int key="maxID">295</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand All @@ -982,6 +991,7 @@
<dictionary class="NSMutableDictionary" key="actions">
<string key="didClickOnButton1:">id</string>
<string key="didClickOnButton2:">id</string>
<string key="didClickOnPageControl:">UIPageControl</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="didClickOnButton1:">
Expand All @@ -992,6 +1002,10 @@
<string key="name">didClickOnButton2:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="didClickOnPageControl:">
<string key="name">didClickOnPageControl:</string>
<string key="candidateClassName">UIPageControl</string>
</object>
</dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="_backLayerView">UIImageView</string>
Expand Down

0 comments on commit 75a5d68

Please sign in to comment.