有人可以给我解释一下为什么当变量被定义为浮点数时被称为活性为0,而被定义为整形时显示是正确的值?我另一个浮点数用了好多次就用的很好,没有这种问题。 @implementation AppPrefsViewControllerfloat age;int activity;...-(void) updateAValues{ if (selectedActivityUnit == 0){ activity = 50; NSLog(@"activity = %d",activity); } if (selectedActivityUnit == 1){ activity = 75; NSLog(@"activity = %d",activity); } }....- (void)updateLabel { if (selectedUnit == 0) { subView.hidden = YES; age = 1; NSLog(@"age = %d",age); } if (selectedUnit == 1) { subView.hidden = YES; age = 2; NSLog(@"age = %d",age); } if (selectedUnit == 2) { subView.hidden = NO; age = 3; NSLog(@"age = %d",age); }}
复制代码 |
|