Accepting user input with form elements
There are many other user input methods that are not buttons. Cocos2d v3 brings a whole suite of form components that were missing from previous versions.
It is also possible to include UIKit components, but in nearly all cases, a better user experience will be provided by using the Cocos2d equivalent.
The form elements available are as follows:
CCButton
CCTextField
CCLabelTTF
,CCLabelBMFont
CCSlider
CCScrollView
CCTableView
To use these elements, you must provide images for their appearance. However, there is an easier method. SpriteBuilder comes with template versions of the form components and makes their use very simple.
These are what each component looks like in an app.
- Start a new SpriteBuilder project.
- Drag out some form elements onto the screen and then publish it in Xcode. In order to use these form elements you have placed, you will need to set up code connections.
- Open the Xcode project for your SpriteBuilder project, and then open the
MainScene.m
...