0

I want to append string to Label.

str1 = Hello;

Str2 = Hi;

I am able to append two string but it shows me like "Hello Hi", I want second string in new line like

Hello

Hi

Please any one suggest me how can i do that?

Anki
  • 609
  • 2
  • 13
  • 22

2 Answers2

2

You have to use an escape sequence. "\n".

NSString *str1 = @"Hello";
NSString *str2 = @"Hi";
NSString *finalString = [NSString stringWithFormat:@"%@\n%@", str1, str2];

finalString contains the result that you want.

Tanvir Ahmed
  • 805
  • 6
  • 9
1

The newline character in Objective-C is \n

furtive
  • 1,489
  • 2
  • 12
  • 14