好的,所以我的程序似乎运行良好并完成了我需要的所有计算,程序需要的最后一块是递增的切割清单。所以我尝试构建一个 NSMutable 数组并使用以前设置的变量,我最终将使用这些变量填充一个表。只有当我运行代码并点击计算按钮时,程序才会冻结,并且在 NSLOG 等中没有显示任何内容。我可以不使用在 for 循环之外设置的先前变量吗?还是怎么回事?
-(IBAction)calculateGo
{
BuildNavAppDelegate *buildNavDelegate = (BuildNavAppDelegate *)[[UIApplication sharedApplication] delegate];
float iridge = ([ridge.text intValue]);
float ihip = ([hip.text intValue]);
float ispacing = ([rafterSpace.text intValue]);
float floatTLPMR = [buildNavDelegate.TLPMR floatValue];
int floatRafter = [buildNavDelegate.raftThicknessPassed intValue];
int comraftbird = [buildNavDelegate.comRaftBirdPassed intValue];
float mitre = (45 * M_PI) / 180;
float y = tanf(mitre);
float mitreThickness = sqrt((y*y)+1) * ihip;
float TLRafterSpace = (floatTLPMR * ispacing);
float firstCreeper = (TLRafterSpace + (mitreThickness/2))-(floatRafter/2);
firstCreep.text = [[NSString alloc] initWithFormat:@"%.1f", firstCreeper];
float comSetBack = floatTLPMR * (iridge/2);
comRaftSetBack.text = [[NSString alloc] initWithFormat:@"%.1f", comSetBack];
float crownSetBack = (floatTLPMR * (floatRafter/2));
crownEndSetBack.text = [[NSString alloc] initWithFormat:@"%.1f", crownSetBack];
creeperArray = [[NSMutableArray alloc] initWithCapacity:20];
for (int x = firstCreeper; x <= comraftbird; x + TLRafterSpace) {
[creeperArray addObject:[NSString stringWithFormat:@"%d", x]];
}
}