Game Development Reference
In-Depth Information
Figure 11-17 . Editing localized strings, each containing the %i string format specifier
Finally, with the bitmap font label still selected, switch to the Item Code Connections tab.
Enter _hitsLabel as the doc root var for the label. Now you can switch to Xcode. Open
the GameMenuLayer.m file, and append the ivars highlighted in Listing 11-17 .
Listing 11-17 . The ivars needed to format the localized string
@implementation GameMenuLayer
{
__weak CCLabelBMFont* _hitsLabel;
NSString* _hitsLocalizedFormatString;
int _hitCount;
}
Next to the expected _hitsLabel , you'll need the _hitsLocal-
izedFormatString as a reference to the label's original localized string. That's one of
the localized strings with the %i format string specifier that was shown in Figure 11-17 .
You need to keep a copy of the original string simply because the string needs to be
formatted and then set to the label to show an actual value in place of the %i format speci-
fier. But once you've done so, that format specifier will be replaced by the _hitCount
number.
Search WWH ::




Custom Search