使用Objective-C在iOS警报消息中添加换行符

问题描述 投票:22回答:2

一个菜鸟问题。

我有一个提醒:

"alertMessage" = "This is my message:    1  2  3.  And another one: 5 6 7";

我正在展示:

NSString *asd = NSLocalizedString (@"alertMessage", @"");
NSString *alertTitle = NSLocalizedString (@"alertTitle", @"");

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:alertTitle message:asd delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];

我如何实现换行,以便“另一个:”从第二行开始。

谢谢!

objective-c ios ios5 uialertview
2个回答
59
投票

在邮件中添加换行符(\ n)。


10
投票

在字符串文字中添加\ n。

More details here

© www.soinside.com 2019 - 2024. All rights reserved.