Pan gestures are intended for moving nodes around that you don’t want to be centered on the user’s exact touch location. So for example, nodes that have been added to the array of panning items will be adjusted relative to the user’s movements. If the finger moves 100 points to the left, the nodes following the pan will move 100 points (regardless of where exactly the panning occurred). This is good for menu items as demonstrated in the video here.
Panning is setup through events, so the following properties are all events….
PanX – A string or array of strings to specify nodes that will move based on the user’s finger panning across the screen on the X axis.
PanY – A string or array of strings to specify nodes that will move based on the user’s finger panning across the screen on the Y axis.
RemovePan – removes all panning gestures
AddOrRemovePanX – Will toggle adding or remove panning on the nodes specified on the X axis only. If panning is currently on for these nodes, it will be turned off.
AddOrRemovePanY – Will toggle adding or remove panning on the nodes specified on the Y axis only. If panning is currently on for these nodes, it will be turned off.
You can also create a PanEvents dictionary in the root of the page dictionary, which will run events anytime the user pans. For example, try setting up the following PanEvents dictionary in the screenshot. Anytime you pan around the screen you will see the words “I panned” in the output window….
If you stumbled onto this article, it is part of our documentation for the Story Tellers iOS Starter Kit 2. The kit enables you to make children’s book apps and games without writing any code! But it is Swift 2 based and compatible with iOS9 (or higher) and Xcode 7 (or higher), so kit buyers can even extend the functionality to fit their needs further. Some of what we cover in the kit documentation may apply to Xcode in general, so this article could be worth a read even if you aren’t a user. You can purchase Lifetime Updates the kit here, or subscribe Yearly to CartoonSmart and get the latest version, plus access to all of our other kits / tutorials.
We’ve also created an iBook to document the very latest properties in the kit, so be sure to download that as well.