<commit_before># Paging UIScrollView with Previews in Cocos2D

This project shows how to create a paged UIScrollView with Previews
in Cocos2D. It looks like this ([video](http://www.youtube.com/watch?v=2IgbRzGfBHk&fmt=22))
![iPhone Preview](http://github.com/jashmenn/shapes-panels/raw/master/Resources/iphone-preview.jpg)

[Watch the video!](http://www.youtube.com/watch?v=2IgbRzGfBHk&fmt=22)

# The Problem

Apple's UIScrollView paging doesn't support an arbitrary width argument. If you
make a UIScrollView with a width smaller than the whole screen, then that view
won't capture touches outside of that area.

Additionally, we are mixing Cocoa views and Cocos2d/OpenGL, and how they interact is
not always obvious.  

# Basic Idea

We create a subclass of `CCMenu` and add panels as items. The `CCMenu` is scrolled
as the `UIScrollView` is scrolled. The `UIScrollView` is set to be smaller than
the whole screen: this gives us previews on either side of the current page.
We create a full-screen `TouchDelegatingView` under the `UIScrollView` and use
that to delegate touches that lie outside the `UIScrollView`.

There are a few custom classes mixed in, but that is the basic idea.

![Panels Layers](http://github.com/jashmenn/shapes-panels/raw/master/Resources/shapes-panels-post.jpg)

# Credits

Written by <NAME> for [Jacob's Shapes](http://www.littlehiccup.com), an
iPhone game for toddlers.

It uses ideas and code from the following sites:

 *   [http://getsetgames.com/2009/08/21/cocos2d-and-uiscrollview/](http://getsetgames.com/2009/08/21/cocos2d-and-uiscrollview/)
 *   [http://blog.proculo.de/archives/180-Paging-enabled-UIScrollView-With-Previews.html](http://blog.proculo.de/archives/180-Paging-enabled-UIScrollView-With-Previews.html)
 <commit_msg>fixed how ios-4.1 deals with canceling touches:<commit_after># Paging UIScrollView with Previews in Cocos2D

This project shows how to create a paged UIScrollView with Previews
in Cocos2D. It looks like this ([video](http://www.youtube.com/watch?v=2IgbRzGfBHk&fmt=22))
![iPhone Preview](http://github.com/jashmenn/shapes-panels/raw/master/Resources/iphone-preview.jpg)

[Watch the video!](http://www.youtube.com/watch?v=2IgbRzGfBHk&fmt=22)

# The Problem

Apple's UIScrollView paging doesn't support an arbitrary width argument. If you
make a UIScrollView with a width smaller than the whole screen, then that view
won't capture touches outside of that area.

Additionally, we are mixing Cocoa views and Cocos2d/OpenGL, and how they interact is
not always obvious.  

# Basic Idea

We create a subclass of `CCMenu` and add panels as items. The `CCMenu` is scrolled
as the `UIScrollView` is scrolled. The `UIScrollView` is set to be smaller than
the whole screen: this gives us previews on either side of the current page.
We create a full-screen `TouchDelegatingView` under the `UIScrollView` and use
that to delegate touches that lie outside the `UIScrollView`.

There are a few custom classes mixed in, but that is the basic idea.

![Panels Layers](http://github.com/jashmenn/shapes-panels/raw/master/Resources/shapes-panels-post.jpg)

# Credits

Written by <NAME> for [Jacob's Shapes](http://www.littlehiccup.com), an
iPhone game for toddlers.

It uses ideas and code from the following sites:

 *   [http://getsetgames.com/2009/08/21/cocos2d-and-uiscrollview/](http://getsetgames.com/2009/08/21/cocos2d-and-uiscrollview/)
 *   [http://blog.proculo.de/archives/180-Paging-enabled-UIScrollView-With-Previews.html](http://blog.proculo.de/archives/180-Paging-enabled-UIScrollView-With-Previews.html)
 

# CHANGELOG

2010-09-17 - fixed how ios 4.1 deals with canceling touches
{'fraction_non_alphanumeric': 0.1015925315760571, 'fraction_numerical': 0.0214168039538715, 'mean_word_length': 4.737007874015748, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6105831', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1223, 'n_words': 380}