O'Reilly logo

Sparrow iOS Game Framework Beginner's Guide by Johannes Stein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – updating the scene and dialog classes

To add our first buttons, use the following steps:

  1. Open the Dialog.h file.
  2. Add properties for both Yes and No buttons using the following code:
    @propertySPButton *buttonYes;
    @propertySPButton *buttonNo;
  3. Switch to Dialog.m.
  4. Refactor all references from the local variables to use the properties.
  5. Update the positions of _title and _content using the following code:
    content = [SPTextField textFieldWithWidth:background.width - 96.0f height:background.height - 150.0f text:@"Dialog default text"];
    _content.x = 52.0f;
    _content.y = 66.0f; [SPTextField registerBitmapFontFromFile:@"PirateFont.fnt"]; _title = [SPTextField textFieldWithWidth:background.width * 0.6 height:30.0f text:@"Dialog"]; _title.fontName ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required