我保存ABpeoplepickerNavcontroller的名字和姓氏,我想在保存到數組之前合併第一個和最後一個名字,以便當我檢索它時,他們會在一起。第一個代碼正在創建的對象:我想在數組中合併兩個對象或保存之前
// setting the first name
firstName.text = (NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
// setting the last name
lastName.text = (NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);
這裏就是我保存它:
NSMutableArray *array = [[NSMutableArray alloc] init];
[array addObject:firstName.text];
[array addObject:lastName.text];
[array addObject:addressLabel.text];
[array writeToFile:recipient atomically:NO];
[array release];
我可以節省一行添加兩個對象?或者我可以在添加到數組之前合併對象嗎?
謝謝,並備案......本網站和曾幫助過我的人都非常棒。
邁克爾
感謝所有的回覆,這是最好的選擇......我忘記了組合函數的功能。 5周前,記住代碼時,聲音是永恆的。感謝大家。 – 2010-01-27 03:51:45