Questions tagged [sklabelnode]

Node that draws strings on iOS systems.

Node that draws strings on iOS systems.

https://developer.apple.com/library/IOs/documentation/SpriteKit/Reference/SKLabelNode_Ref/index.html

196 questions
21
votes
3 answers

How to set font size of SKLabelNode to fit in fixed size (Swift)

I have a square (200X200) with a SKLabelNode in it. The label shows score and it my be reach a large number. I want fit the number in the square. How can i change text size (or Size) of a SKLabelNode to fit it in a fixed size.
nmokkary
  • 1,219
  • 3
  • 14
  • 24
18
votes
4 answers

Programmatically Make a SKLabelNode Bold in swift

As the title states - I would like to make my SKLabelNodebold programmatically. How do I go about this?
LukeTerzich
  • 555
  • 1
  • 4
  • 17
16
votes
2 answers

Multi-line label in swift 2 sprite-kit?

I need to be able to make a multi-line label in swift 2 sprite-kit for a game. The text needs to wrap around rather than go off of the screen. Bellow is what I have but I do not know what to do import Foundation import UIKit import SpriteKit class…
JaredD101
  • 161
  • 1
  • 3
15
votes
1 answer

Way to know the width of the text in SKLabelNode

Is there a way to know the width of a "SKLabelNode" in Sprite Kit ? OR I should use SKSpriteNode then use text inside it
Nour
  • 333
  • 2
  • 10
15
votes
1 answer

How can I set the alignment of a SKLabelNode

I'm trying to keep the left side of an SKLabelNode fixed after updating it. The thing is that the SKLabelNode is growing in both directions. All I want is to grow only in the right side. Thanks a lot.
Ady Năstase
  • 249
  • 2
  • 9
13
votes
1 answer

Adjust text size to fit SKLabelNode with fixed width

New to Spritekit and trying to fix the width of a SKLabelNode and then adjust the font of text to fit within the node accordingly. Have been looking through the docs but cant seem to find anything suitable, like the UILabel function: A…
dancingbush
  • 2,131
  • 5
  • 30
  • 66
12
votes
3 answers

Setting background color for SKLabelNode?

I want to know is there a way to set background color for a SKLabelNode not font color. I'm looking for something like below mentioned code, which is available in ios apps. label.backgroundColor = [UIColor redColor];
Jaffer Sheriff
  • 1,444
  • 13
  • 33
12
votes
3 answers

Centre a SKLabelNode on a SKSpriteNode

I have an SKLabelNode that is the child of a SKSpriteNode because I'm trying to create a Button class to create buttons in an easier way. I've tried a couple of things using the anchor point of the SKSpriteNode, but I don't quite understand exactly…
02fentym
  • 1,762
  • 2
  • 16
  • 29
10
votes
0 answers

Resize a SKLabelNode font size to fit?

I'm creating a label inside of sprite kit and setting an initial size. Since the app is to be localized, words may appear longer in other languages than their english version. Therefore how can I adjust the font size of the label to fit within a…
Edward
  • 7,346
  • 8
  • 62
  • 123
7
votes
1 answer

Add label to SKSpriteNode without it being touchable

How do I turn off interaction for a childnode? I'm adding labels to a bunch of sprites, beneath the sprite, describing what they are. The sprites themselves are touchable, and have code that responds when touchesBegun etc. The labels do not…
Confused
  • 6,048
  • 6
  • 34
  • 75
7
votes
1 answer

SKLabelNode removes leading and trailing spaces - How can I stop that?

I wanted to create an SKLabelNode, which is supposed to have always the same length (for a word guessing game). Unfortunately SKLabelNode decides to always cut off any leading and trailing spaces. This behavior is not described in the documentation.…
gebirgsbärbel
  • 2,327
  • 1
  • 22
  • 38
6
votes
0 answers

SKLabelNode + NSMutableAttributedString = no shadow

let paragraph = NSMutableParagraphStyle() paragraph.alignment = NSTextAlignment.right paragraph.tailIndent = -3 let shadow = NSShadow() shadow.shadowBlurRadius = 5 shadow.shadowColor = UIColor.gray shadow.shadowOffset =…
6
votes
3 answers

Is there really no way to style SKLabelNode?

Is there really no way to style SKLabelNode? I mean beyond changing the font, and the color. I know I can do something like adding a drop shadow by creating a second SKLabelNode behind the first (already sort've hacky).. Creating images for my…
hamobi
  • 7,940
  • 4
  • 35
  • 64
6
votes
3 answers

SKLabelNode delays app start

at the moment I'm coding a little app with SpriteKit, which works perfectly fine, but the only problem is an SKLabelNode, which I initialize with the following normal piece of code: ​self.scoreLabel = [SKLabelNode…
appcodix
  • 342
  • 2
  • 15
5
votes
2 answers

How to cache or preload SKLabelNode font?

I'm making a Sprite Kit app and in my scene I added an SKLabelNode. I noticed a pretty large lag-spike when I load the SKScene. After profiling the app I found it came from creating an SKLabelNode with a papyrus font(though the font doesn't matter).…
Exascale
  • 929
  • 1
  • 7
  • 17
1
2 3
13 14