Dvole
Dvole

Reputation: 5795

How to add UIView as child to SKNode?

As I have found out there is no easy way to add UIViews as children to SKNodes. I know there is a scene method didMoveToView, but I would like to make a custom text box, and I want to encapsulate all code about it there.
I have a separate class for TextBox (from SKNode), and it creates background and layouts itself, but as I found out SKLabelNode does not support multiline text and I need that.
I'm left with option showing my text box and separate UILabel over it in scene, but this breaks all incapsulation.

What options are available to me if I want to have custom text box made of SKNode?

Upvotes: 1

Views: 2516

Answers (1)

Tricertops
Tricertops

Reputation: 8512

Obvious option is placing UILabel above your SKView. You can also synchronize frame with some SKNode to be able to move the label using node manipulation.

Upvotes: 1

Related Questions