All About TextFields

A Textfield is a Label or way to show text without an image. You can use and make a TextField quite simply using the following code samples.

// create the text field
SPTextField *textField = [SPTextField textFieldWithText:@"blah!"];
textField.fontName = @"Georgia-Bold";
textField.fontSize = 18;
textField.color = 0xaaaaff; //0xRRGGBB
 
// add it to the display list!
[self addChild:textField];
The First line of code Creates the textfield with the text "blah!" and stores it.
The Second line tells the textfield to change the font to Georgia-Bold.
The Third line tells the textfield to make it 18px.
The Fourth line tells what color it will be.
And the last line prints the textfield to the screen.
  tutorials/all_about_textfields.txt · Last modified: 2013/03/05 10:19 by 127.0.0.1
 
Powered by DokuWiki