diff options
author | Starla Insigna <starla4444@gmail.com> | 2011-08-23 09:24:14 -0400 |
---|---|---|
committer | Starla Insigna <starla4444@gmail.com> | 2011-08-23 09:24:14 -0400 |
commit | 02d9a87417837ffda602b2d06c2c6897d15a1202 (patch) | |
tree | f86db8e466f92df47c1f00c34e2cacfd01595d37 /Classes/GameModeSelectionLayer.m | |
parent | c9337218ef1660360097928c753bde1c79775618 (diff) | |
download | cartcollect-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/GameModeSelectionLayer.m')
-rw-r--r-- | Classes/GameModeSelectionLayer.m | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Classes/GameModeSelectionLayer.m b/Classes/GameModeSelectionLayer.m index 9875d41..ad6a455 100644 --- a/Classes/GameModeSelectionLayer.m +++ b/Classes/GameModeSelectionLayer.m | |||
@@ -86,9 +86,15 @@ | |||
86 | [panels addChild:menu]; | 86 | [panels addChild:menu]; |
87 | [self addChild:panels]; | 87 | [self addChild:panels]; |
88 | 88 | ||
89 | pageControl = [[UIPageControl alloc] init]; | ||
90 | pageControl.numberOfPages = numberOfPanels; | ||
91 | pageControl.currentPage = currentWorldOffset; | ||
92 | pageControl.frame = CGRectMake(0, 250, 480, 20); | ||
93 | [[[CCDirector sharedDirector] openGLView] addSubview:pageControl]; | ||
94 | |||
89 | menu.position = ccpAdd(menu.position, ccp(totalWidth/2 - totalPanelWidth/2, 320)); | 95 | menu.position = ccpAdd(menu.position, ccp(totalWidth/2 - totalPanelWidth/2, 320)); |
90 | touchDelegatingView = [[TouchDelegatingView alloc] initWithFrame:CGRectMake(0, 0, 480, 320)]; | 96 | touchDelegatingView = [[TouchDelegatingView alloc] initWithFrame:CGRectMake(0, 0, 480, 320)]; |
91 | scrollView = [[CocosOverlayScrollView alloc] initWithFrame:CGRectMake(0, 0, totalPanelWidth, 320) numPages:numberOfPanels width:totalPanelWidth layer:panels]; | 97 | scrollView = [[CocosOverlayScrollView alloc] initWithFrame:CGRectMake(0, 0, totalPanelWidth, 320) numPages:numberOfPanels width:totalPanelWidth layer:panels pageControl:pageControl]; |
92 | touchDelegatingView.scrollView = scrollView; | 98 | touchDelegatingView.scrollView = scrollView; |
93 | [scrollView setContentOffset:CGPointMake(currentWorldOffset*totalPanelWidth+1,0) animated:NO]; | 99 | [scrollView setContentOffset:CGPointMake(currentWorldOffset*totalPanelWidth+1,0) animated:NO]; |
94 | [[[CCDirector sharedDirector] openGLView] addSubview:touchDelegatingView]; | 100 | [[[CCDirector sharedDirector] openGLView] addSubview:touchDelegatingView]; |
@@ -107,6 +113,7 @@ | |||
107 | { | 113 | { |
108 | [touchDelegatingView removeFromSuperview]; | 114 | [touchDelegatingView removeFromSuperview]; |
109 | [scrollView removeFromSuperview]; | 115 | [scrollView removeFromSuperview]; |
116 | [pageControl removeFromSuperview]; | ||
110 | } | 117 | } |
111 | 118 | ||
112 | - (void)mainmenu | 119 | - (void)mainmenu |