【发布时间】:2012-04-02 13:43:57
【问题描述】:
我在使用 NSString stringWithFormat 时遇到了一个非常基本的问题。我想取用户输入的名称并在 alertView 中显示:欢迎用户名。
NSString *welcomeMessage = [NSString stringWithFormat:(@"Welcome %@", passedData)];
UIAlertView *alert = [[UIAlertView alloc] //show alert box with option to play or exit
initWithTitle: welcomeMessage
message:@"Once you press \"Play\" the timer will start. Good luck!"
delegate:self
cancelButtonTitle:@"I want out!"
otherButtonTitles:@"Play",nil];
[alert show];
passedData 是已输入的用户名。我现在的方式 - 只有用户名显示在警报框的标题中,而不是“欢迎”部分。我知道我在这里缺少一些真正的基本知识,但希望能得到一些帮助。
【问题讨论】:
标签: iphone objective-c nsstring uialertview stringwithformat