Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Cocos2d Game Development Essentials

You're reading from   Cocos2d Game Development Essentials For new users - a quickstart guide to bringing your mobile game ideas to life with Cocos2D

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781784390327
Length 136 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ben Trengrove Ben Trengrove
Author Profile Icon Ben Trengrove
Ben Trengrove
Arrow right icon
View More author details
Toc

Presenting data in a table with CCTableView

The CCTableView node is the Cocos2d equivalent of UITableView. It can be used in your game whenever you need to present a scrollable list of items such as a high score table. It works a lot like UITableView, where a data source provides the instance of the cell to show on screen. In order to learn how to use CCTableView, you will create a simple mocked up high score screen. The scores will be stubbed out, but could be easily switched for real data if you want to use this implementation in your game.

Start a new Xcode project and delete all the boilerplate code from the HelloWorldScene.m file, so you are left with a blank scene. You might want to leave the back button so that you can navigate back to the main menu.

Creating a CCTableView data source

The first step is to create the data source for your table view. This could be done in a separate class, but to keep things simple in this tutorial, your scene will also be the data source. Following are...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image