将多个TEXT和变量连接成一个字符串iOS?

时间:2013-10-22 10:19:54

标签: ios objective-c xcode nsstring xcode5

我正在试图找出我认为简单连接的错误,我必须在这里遗漏一些东西 - 请参阅下面的代码:

NSString *combinedValues = [NSString stringWithFormat:
                            @"I am at %@" self.dancePlace.text
                            @" Airport, and I will arrive on %@" danceDateValue,
                            @" from %@" timeIn,
                            @" to %@" timeOut,
                            @" at Terminal %@" self.danceTerminal.text
                            @" Gate %@" self.danceGate.text];

1 个答案:

答案 0 :(得分:5)

这是一个好方法

NSString *combinedValues = [NSString stringWithFormat:
                            @"I am at %@ Airport, and I will arrive on %@ from %@ to %@ at Terminal %@ Gate %@" , self.dancePlace.text, danceDateValue, timeIn, timeOut, self.danceTerminal.text, self.danceGate.text];
相关问题