【问题标题】:NSArray arrayWithObjects needs nil at the end, NSString stringWithFormat and NSLog() doesn't. Why?NSArray arrayWithObjects 最后需要 nil, NSString stringWithFormat 和 NSLog() 不需要。为什么?
【发布时间】:2012-04-02 04:49:04
【问题描述】:

NSArray arrayWithObjects 最后需要 nil, NSString stringWithFormat 和 NSLog() 不需要。为什么?

[NSArray arrayWithObjects:<#(id), ...#>, nil] 

[NSString stringWithFormat:<#(NSString *), ...#>]

NSLog(<#NSString *format, ...#>)

【问题讨论】:

标签: objective-c


【解决方案1】:

因为-stringWithFormat:NSLog 可以根据它们的格式字符串(第一个参数)推断参数的数量。 -arrayWithObjects:不能。

【讨论】:

猜你喜欢
  • 2012-02-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-06-09
  • 2013-04-01
  • 2018-03-18
  • 1970-01-01
相关资源
最近更新 更多