2012-03-06 12 views
0

NSMutable配列のデータをメール本文に組み込む方法を理解しようとしています。NSMutable配列から文字列を結合する方法

- (void)emailBody 
{ 
    NSLog(@"Number of Songs: %@", profile.profileNumberOfSongs); 
    NSLog(@"Profile Length: %@", [self convertSecondstoMMSS:[profile.profileDuration intValue]]); 

    for (ProfileItems *item in profileItemsNSMArray) 
    { 
     NSLog(@"%@ %@ - %@ %@", item.profileItemsSongOrder, item.profileItemsMovementName, item.profileItemsArtist, item.profileItemsSong); 
    } 
} 

のNSLog出力:

Number of Songs: 9 
Profile Length: 40:07 
1 Seated Flat - Foo Fighters Home 
2 Seated Flat - Foo Fighters What If I Do? 
3 Standing Climb - Foo Fighters Tired Of You 

電子メールの本文であることを渡される単一のNSStringにこのデータを格納するための最良の方法は何ですか?次のコードは、次のNSLog出力を生成しますか

-Paul事前に感謝

答えて

0
- (NSString *)emailBody 
{ 
    NSMutableString *emailBodyString = [NSMutableString string]; 
    [emailBodyString appendFormat:@"Number of Songs: %@", profile.profileNumberOfSongs]; 
    [emailBodyString appendFormat:@"Profile Length: %@", [self convertSecondstoMMSS:[profile.profileDuration intValue]]]; 

    for (ProfileItems *item in profileItemsNSMArray) 
    { 
     [emailBodyString appendFormat:@"%@ %@ - %@ %@", item.profileItemsSongOrder, item.profileItemsMovementName, item.profileItemsArtist, item.profileItemsSong]; 
    } 

    return emailBodyString; 
} 
+0

すごいです!迅速な対応に感謝します。 –

+1

答えが受け入れられた後、受け入れられなかったことを示します。それは動作しませんでしたか? – Marco

関連する問題