我在 XCode 中闲逛,试图了解一些有关 iOS SDK 和 Objective-C 的知识。
我在下面有这个 for 循环,它应该在屏幕上打印出几个值(取决于选择的月份数),但它只是打印出最终值。
谁能指出为什么?
非常感谢,提前!
for (int i = 1; i <= myMonthsDouble; i++)
{
myPaymentAmount = (myBalanceDouble/10) + myInterestDouble;
myBalanceDouble -= myPaymentAmount;
//convert myPaymentAmount double into string named myPaymentAmountString
NSString *myPaymentAmountString = [NSString stringWithFormat:@"%f", myPaymentAmount];
NSString *paymentInformation = [[NSString alloc] initWithFormat:@"%@ months, %@ per month.", monthsString, myPaymentAmountString];
myInterestDouble = (myBalanceDouble * (myInterestDouble/100))/12;
self.label.text = paymentInformation;
}