我想添加一個預定義的字符串到NSMutableArray的對象。我以爲你會使用%@
,但顯然下面的代碼執行不好。謝謝你在前進將變量插入NSMutableArray對象
arrayData = [[NSMutableArray alloc]
initWithObjects:@"%@ you look tired." name,
@"Why do you smell so bad?",
@"I have to go potty!",
@"%@ put your pants on!" name,
@"Mommy!",
@"Daddy!",
@"NOOOOOO!",
@"When are we going to get there?",
@"I HATE YOU!",
nil];
每當你做一個格式化字符串時,在它和你要替換的變量之間加逗號。在上面,你應該有...... @「你看起來很累」,名字...... – Luke 2010-11-26 00:23:40