summary refs log tree commit diff stats
path: root/Classes/CocosOverlayScrollView.m
diff options
context:
space:
mode:
Diffstat (limited to 'Classes/CocosOverlayScrollView.m')
-rwxr-xr-xClasses/CocosOverlayScrollView.m9
1 files changed, 8 insertions, 1 deletions
diff --git a/Classes/CocosOverlayScrollView.m b/Classes/CocosOverlayScrollView.m index dcf5571..dee9dfe 100755 --- a/Classes/CocosOverlayScrollView.m +++ b/Classes/CocosOverlayScrollView.m
@@ -12,7 +12,7 @@
12@synthesize targetLayer; 12@synthesize targetLayer;
13 13
14// Configure your favorite UIScrollView options here 14// Configure your favorite UIScrollView options here
15-(id) initWithFrame: (CGRect) frameRect numPages: (int) numPages width: (float) width layer: (CCNode*) layer { 15-(id) initWithFrame: (CGRect) frameRect numPages: (int) numPages width: (float) width layer: (CCNode*) layer pageControl:(UIPageControl *)m_pageControl{
16 if ((self = [super initWithFrame: frameRect])){ 16 if ((self = [super initWithFrame: frameRect])){
17 self.contentSize = CGSizeMake(width*numPages, 320); 17 self.contentSize = CGSizeMake(width*numPages, 320);
18 self.bounces = YES; 18 self.bounces = YES;
@@ -26,6 +26,7 @@
26 [self setScrollEnabled:TRUE]; 26 [self setScrollEnabled:TRUE];
27 self.targetLayer = layer; 27 self.targetLayer = layer;
28 // self.canCancelContentTouches = YES; 28 // self.canCancelContentTouches = YES;
29 pageControl = m_pageControl;
29 } 30 }
30 return self; 31 return self;
31} 32}
@@ -96,4 +97,10 @@
96 self.targetLayer = nil; 97 self.targetLayer = nil;
97 [super dealloc]; 98 [super dealloc];
98} 99}
100
101- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
102{
103 [pageControl setCurrentPage:(NSUInteger)([scrollView contentOffset].x / [scrollView frame].size.width)];
104}
105
99@end \ No newline at end of file 106@end \ No newline at end of file