Multiple line PXTextField
  • sumiguchisumiguchi September 2011
    Posts: 72

    Is it possible to have a text field span multiple lines? I tried using \n but it just ignored it.

    Ideally, I'd like to be able to define an area and then have the text auto-wrap as required.

  • sumiguchisumiguchi September 2011
    Posts: 72

    Just for the record, I split my string with a delimiter and then iterated through the resulting array drawing text fields.


    NSArray *texts = [myAmalgamatedText componentsSeparatedByString: @"|"];
    int i = 0;
    int LINE_HEIGHT = 35;
    for (NSString* text in texts)
    {
    PXTextField* textField = [PXTextField textFieldWithFont:@"myFont"];
    textField.text = @"0"; textField.x = 40.0f; textField.y = 20+ i*LINE_HEIGHT ;
    [self addChild:textField];
    i++; }

    This allowed me to space the lines as I wanted, but on the downside - I have to manage the length of the lines manually... which isn't a big problem ;)

  • oztuneoztune September 2011
    Posts: 177

    Yeah, it's on the todo list, but currently isn't at the highest priority.

    I'm glad you found a solution
    Pixelwave team
    // Founder

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Twitter Sign In with OpenID

Sign In Apply for Membership

In this Discussion

Tagged

Top Posters