需要格式化数字四位数字,无小数,包括左边的0,例如0012. 我在 Xcode for iPhone 上编写这段代码。
if (Tipo.selectedSegmentIndex == 2 ) {
float a = [N1.text floatValue]; float b = [N2.text floatValue];
float c = a*b;
R.text = [[NSString alloc] initWithFormat:@"%.0f",c];
}
最佳答案
尝试这样的事情,如果有帮助请告诉我
self.yourTimeHere.text = [NSString stringWithFormat:@"%d.%d", (int)hours, (int)minutes];
关于ios - SDK7 格式编号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19397050/