nsstring - Splitting a string to more lines objective c -


this question has answer here:

i know how create nsstring that, when displayed, shows on 2 lines. i've tried \n or @"\n" , nothing works.

    sklabelnode *gameinstructions = [sklabelnode labelnodewithfontnamed:@"avenirnext-heavy"];     gameinstructions.text = [nsstring stringwithformat:@"play! \n  hello"];     gameinstructions.fontcolor = [self randomcolor];     gameinstructions.fontsize = [self convertfontsize:30];     gameinstructions.zposition = 0;     gameinstructions.horizontalalignmentmode = sklabelhorizontalalignmentmodecenter;     gameinstructions.position = cgpointmake(cgrectgetmidx(self.frame), cgrectgetmidy(self.frame));     skaction *textfade = [skaction fadealphato:0 duration:7];     [gameinstructions runaction:textfade];     [self addchild:gameinstructions]; 

so how app display "hello" on separate line "play!"?

with addition question of container type sklabelnode question not seem support multi-line text. adding line break character \n not produce desired result: 2 lines of text.

in instance answer not work.

for line break:

gameinstructions.text = @"play!\nhello";   

the line breakcharacter in ios \n.

but wether or not break when displayed depend on container supporting multiple lines.

btw:

gameinstructions.text = [nsstring stringwithformat:@"play!  hello"]; 

is redundant, simply:

gameinstructions.text = @"play!  hello";.  

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -