Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将字符串附加到标签。
str1 = 你好;
Str2 = 嗨;
我可以附加两个字符串,但它显示像“Hello Hi”,我想要新行中的第二个字符串
你好
请任何人建议我该怎么做?
您必须使用转义序列。“\n”。
NSString *str1 = @"Hello"; NSString *str2 = @"Hi"; NSString *finalString = [NSString stringWithFormat:@"%@\n%@", str1, str2];
finalString 包含您想要的结果。
Objective-C 中的换行符是\n
\n