我试图格式化该字符串,秒后跟3个小数点,例如1.123。
我该如何去做这件事?格式cctime,小数点后3位
-(void)update:(ccTime)dt {
totalTime += dt*1000;
currentTime = (int)totalTime;
if (myTime < currentTime)
{
myTime = currentTime;
[timeLabel setString:[NSString stringWithFormat:@"%i", myTime]];
}
}
请书签[IEEE规范的printf(http://pubs.opengroup.org/onlinepubs/009695399/functions/fprintf.html) 。任何使用'stringWithFormat:'的人都应该熟悉那个页面。 – rmaddy
我不是。伟大的联系,我一直在想,如果这样的网页存在,但从来没有打扰检查。 – LearnCocos2D