Because we want a way to show the user their past high scores, in the GameOver
scene, we're going to add a table that displays the most recent high scores that are saved. For this, we're going to use CCTableView
. It's still relatively new, but it works for what we're going to use it.
Although UITableView
might be known to some of you who've made non-Cocos2d apps before, you should be aware of its downfalls when it comes to using it within Cocos2d. For example, if you want a BMFont in your table, you can't add LabelBMFont
(you could try to convert the BMFont into a TTF font and use that within the table, but that's outside the scope of this book).
If you still wish to use a UITableView
object (or any UIKit
element for that matter), you can create the object like normal, and add it to the scene, like this (tblScores
is the name of the UITableView
object):
[[[CCDirector sharedDirector] view] addSubview:tblScores];