0

このエラーが発生しましたが、ここではどういう意味ですか。

[mediaPlayTime setText:[NSString stringWithFormat:@"%@ / %@", [self formatTime:currentTime],[self formatTime:duration]]];

- (NSString*)formatTime:(float)time{
int minutes = time / 60;
int seconds = (int)time % 60;
return [NSString stringWithFormat:@"%@%d:%@%d", minutes / 10 ? [NSString stringWithFormat:@"%d", minutes / 10] : @"", minutes % 10, [NSString stringWithFormat:@"%d", seconds / 10], seconds % 10];
}
4

1 に答える 1

2

.hで

  -(NSString*)formatTime:(float)time;

.m

  [mediaPlayTime setText:[NSString stringWithFormat:@"%@ / %@", [self formatTime:currentTime],[self formatTime:duration]]];



 - (NSString*)formatTime:(float)time{
int minutes = time / 60;
int seconds = (int)time % 60;
return [NSString stringWithFormat:@"%@%d:%@%d", minutes / 10 ? [NSString stringWithFormat:@"%d", minutes / 10] : @"", minutes % 10, [NSString stringWithFormat:@"%d", seconds / 10], seconds % 10];
}

小さな変更だけで問題は解決しました。

于 2012-10-23T11:56:14.763 に答える