Inherits from PXInteractiveObject : PXDisplayObject : PXEventDispatcher : NSObject
Declared in PXTextField.h
PXTextField.m

Overview

A display object which represents a line of text.

Example: The following code creates a text field with the Helvetica font, that can only accept letters ‘,’ and ‘!’ with size of 30.0f.

[PXTextureFont registerSystemFontWithFont:@"Helvetica"
                                     name:@"fontName"
                              fontOptions:[PXFontOptions fontOptionsWithSize:30.0f
                                                               characterSets:PXFontCharacterSet_AllLetters
                                                           specialCharacters:@",!"]];

PXTextField *textField = [[PXTextField alloc] initWithFont:@"fontName"];

textField.text = @"Hi!";

Tasks

  •   text

    The text of the text field.

    property
  •   font

    The registered name of the font.

    property
  •   fontSize

    The size of the text.

    property
  •   align

    The alignment of the text.

    property
  •   alignHorizontal

    The horizontal alignment of the text. Ranges between 0.0f and 1.0f.

    property
  •   alignVertical

    The vertical alignment of the text. Ranges between 0.0f and 1.0f.

    property
  •   letterSpacing

    The extra space between each letter.

    property
  •   textColor

    The color of the text.

    property
  •   backgroundColor

    The background color of the text field.

    property
  •   backgroundAlpha

    The background alpha of the text field.

    property
  •   background

    If YES it displays the background of the text field.

    property
  •   borderColor

    The border color of the text field.

    property
  •   borderAlpha

    The border alpha of the text field.

    property
  •   border

    If YES it displays the border of the text field.

    property
  •   smoothing

    If the text should be smoothed when transformed.

    property
  •   kerning

    If YES and the font has kerning values stored, then your text will be kerned.

    property
  • – initWithFont:

    Creates a new PXTextField with a registered font.

  • + textField

    Creates a PXTextField using the default font (PXTextFieldDefaultFont). No text will be displayed until you set the text property of the PXTextField just created. If no texts exists, then the this object will appear to have 0 size.

  • + textFieldWithFont:

    Creates a PXTextField using the registered font if it exists, or the default font (PXTextFieldDefaultFont). No text will be displayed until you set the text property of the PXTextField just created. If no texts exists, then the this object will appear to have 0 size.

  • + textFieldWithFont:text:

    Creates a PXTextField with a registered font.

Properties

align

The alignment of the text.

@property (nonatomic) PXTextFieldAlign align

Discussion

Default: PXTextFieldAlign_TopLeft

Declared In

PXTextField.h

alignHorizontal

The horizontal alignment of the text. Ranges between 0.0f and 1.0f.

@property (nonatomic) float alignHorizontal

Discussion

Default: 0.0f

Declared In

PXTextField.h

alignVertical

The vertical alignment of the text. Ranges between 0.0f and 1.0f.

@property (nonatomic) float alignVertical

Discussion

Default: 0.0f

Declared In

PXTextField.h

background

If YES it displays the background of the text field.

@property (nonatomic) BOOL background

Discussion

Default: NO

Declared In

PXTextField.h

backgroundAlpha

The background alpha of the text field.

@property (nonatomic) float backgroundAlpha

Discussion

Default: 1.0f

Declared In

PXTextField.h

backgroundColor

The background color of the text field.

@property (nonatomic) unsigned backgroundColor

Discussion

Default: 0xFFFFFF – white

Declared In

PXTextField.h

border

If YES it displays the border of the text field.

@property (nonatomic) BOOL border

Discussion

Default: NO

Declared In

PXTextField.h

borderAlpha

The border alpha of the text field.

@property (nonatomic) float borderAlpha

Discussion

Default: 1.0f

Declared In

PXTextField.h

borderColor

The border color of the text field.

@property (nonatomic) unsigned borderColor

Discussion

Default: 0x000000 – black

Declared In

PXTextField.h

font

The registered name of the font.

@property (nonatomic, copy) NSString *font

Discussion

Default: PXTextFieldDefaultFont

Declared In

PXTextField.h

fontSize

The size of the text.

@property (nonatomic) float fontSize

Discussion

Default: 12.0f

Declared In

PXTextField.h

kerning

If YES and the font has kerning values stored, then your text will be kerned.

@property (nonatomic) BOOL kerning

Discussion

Default: YES

Declared In

PXTextField.h

letterSpacing

The extra space between each letter.

@property (nonatomic) float letterSpacing

Discussion

Default: 0.0f

Declared In

PXTextField.h

smoothing

If the text should be smoothed when transformed.

@property (nonatomic) BOOL smoothing

Discussion

Because smoothing is a relatively expensive operation, it’s recommended to only turn it on when the text field is being transformed (such as during an animation).

Default: NO

Declared In

PXTextField.h

text

The text of the text field.

@property (nonatomic, copy) NSString *text

Discussion

Default: nil

Declared In

PXTextField.h

textColor

The color of the text.

@property (nonatomic) unsigned textColor

Discussion

Default: 0x000000 – black

Declared In

PXTextField.h

Class Methods

textField

Creates a PXTextField using the default font (PXTextFieldDefaultFont). No text will be displayed until you set the text property of the PXTextField just created. If no texts exists, then the this object will appear to have 0 size.

+ (PXTextField *)textField

Discussion

Example:

PXTextField *textField = [PXTextField textField];

See Also

Declared In

PXTextField.m

textFieldWithFont:

Creates a PXTextField using the registered font if it exists, or the default font (PXTextFieldDefaultFont). No text will be displayed until you set the text property of the PXTextField just created. If no texts exists, then the this object will appear to have 0 size.

+ (PXTextField *)textFieldWithFont:(NSString *)_fontName

Parameters

fontName

The name of the registered font. If the font does not exist or was not registered then the default (PXTextFieldDefaultFont) is used instead.

Example:

PXTextField *textField = [PXTextField textField];

See Also

Declared In

PXTextField.m

textFieldWithFont:text:

Creates a PXTextField with a registered font.

+ (PXTextField *)textFieldWithFont:(NSString *)_fontName text:(NSString *)_text

Parameters

text

The text for the text field.

Example:

[PXTextureFont registerSystemFontWithFont:@"Helvetica"
                                     name:@"fontName"
                              fontOptions:[PXFontOptions fontOptionsWithSize:30.0f
                                                               characterSets:PXFontCharacterSet_AllLetters
                                                           specialCharacters:@",!"]];

PXTextField *textField = [PXTextField textFieldWithFont:@"fontName" text:@"Hi"];
fontName

The name of the registered font. If the font does not exist or was not registered then the default (PXTextFieldDefaultFont) is used instead.

See Also

Declared In

PXTextField.m

Instance Methods

initWithFont:

Creates a new PXTextField with a registered font.

- (id)initWithFont:(NSString *)_fontName

Parameters

fontName

The name of the registered font. If the font does not exist or was not registered then the default (PXTextFieldDefaultFont) is used instead.

Example:

[PXTextureFont registerSystemFontWithFont:@"Helvetica"
                                     name:@"fontName"
                              fontOptions:[PXFontOptions fontOptionsWithSize:30.0f
                                                               characterSets:PXFontCharacterSet_AllLetters
                                                           specialCharacters:@",!"]];

PXTextField *textField = [[PXTextField alloc] initWithFont:@"fontName"];

textField.text = @"Hi!";

See Also

Declared In

PXTextField.m