这可能是最简单/最蹩脚的问题。
所以我试图在 viewDidLoad 方法中初始化一个值为 0 到 3 个增量为 0.25 的数组,我可以在这里看到一个无限循环。
NSArray *pickArray3 = [[NSMutableArray alloc] init];
int i = 0;
//for(i = 0.25; i<=3; i=i+0.25)
while (i<3)
{
//NSString *myString = [NSString stringWithFormat:@"%d", i];
i=i+0.25;
NSLog(@"The Value of i is %d", i );
//[pickArray3 addObject:myString]; // Add the string to the tableViewArray.
}
NSLog(@"I am out of the loop now");
self.doseAmount=pickArray3;
[pickArray3 release];
这就是输出。
2011-06-01 11:49:30.089 Tab[9837:207] The Value of i is 0
2011-06-01 11:49:30.090 Tab[9837:207] The Value of i is 0
2011-06-01 11:49:30.091 Tab[9837:207] The Value of i is 0
2011-06-01 11:49:30.092 Tab[9837:207] The Value of i is 0
// And this goes on //
// I am out of the loop now does not get printed //