-1

重複の可能性:
nsstring オブジェクトに変数を持つ NSString を割り当てる方法は?

その nsstring オブジェクトを表示しようとすると、次のようになります。

合計時間: l

その代わりに取得したい: 02:35

どうやってするか ?ありがとうございました!

allTime = [NSString stringWithFormat:@"%l/%l", mins, secs];
for(Playlists *thePL in collection)
    {
        NSLog(@"===NEXT PLAYLIST===");
        NSLog(@"Name: %@", thePL.namePL);
        NSLog(@"Quantity of songs: %i", thePL.entries);
        NSLog(@"Total of time: %@",thePL.allTime);
    }
4

2 に答える 2

1

minssecsが整数であると仮定します。

allTime = [NSString stringWithFormat:@"%02i:%02i", mins, secs];

詳細情報が必要な場合は、文字列形式指定子を検索してください

于 2012-07-11T06:50:07.870 に答える
0

longを指定するには、フォーマット指定子%ldを使用する必要があります。

このような..

[NSString stringWithFormat:@"%ld/%ld", mins, secs];
于 2012-07-11T06:53:25.933 に答える