Adding a text field to SKScene

I am creating a game using the Sprite Kit, and I want to add a text box for players to enter their name.

How to create a text box using the Sprite Kit? I am going to create a player object (which I have already configured) and use the name that they enter and the default score is 0. Is it wrong practice or even possible to mix UITextfields and Sprite Kit nodes?

+4
source share
3 answers

Something like that

UILabel *nameField = [[UILabel alloc] initWithFrame:CGRectMake(200, 200, 300, 100)];
[self.view addSubview:nameField];

But I suggest customizing my layout, just like for any other iOS application.

2 , , . , , , IB .

+3

, , , UIViewController SKScene, , SKScenes, UIKit

SKNodes SKScene, :

[self addChild:node]

UIViewController UIKit, UITextView, - :

[self.view addSubview:textView]

, .

0

All Articles