summary refs log tree commit diff stats
path: root/Classes/CocosOverlayScrollView.m
diff options
context:
space:
mode:
authorStarla Insigna <starla4444@gmail.com>2011-08-23 09:24:14 -0400
committerStarla Insigna <starla4444@gmail.com>2011-08-23 09:24:14 -0400
commit02d9a87417837ffda602b2d06c2c6897d15a1202 (patch)
treef86db8e466f92df47c1f00c34e2cacfd01595d37 /Classes/CocosOverlayScrollView.m
parentc9337218ef1660360097928c753bde1c79775618 (diff)
downloadcartcollect-02d9a87417837ffda602b2d06c2c6897d15a1202.tar.gz
cartcollect-02d9a87417837ffda602b2d06c2c6897d15a1202.tar.bz2
cartcollect-02d9a87417837ffda602b2d06c2c6897d15a1202.zip
Added a UIPageControl to the level selection screen selection_screen
The page control updates when you swipe through the levels, but tapping it does nothing. I initially attempted to implement scrolling by tapping on the page control, but for some reason, it worked perfectly in the simulator and only randomly on the iPhone. Very weird.

Refs #207
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