程序化视图在模拟器中可见但在设备上

时间:2016-11-23 19:44:41

标签: ios objective-c iphone

我在Objective-C中以编程方式使用自定义对象创建视图。它在模拟器中运行良好,但是当我在iPhone 6s Plus上运行相同的代码时,它不会渲染行。它确实使用相同的对象呈现稍后在代码中创建的编程行。

SalesTrackerDailyRow *thisRow = [[SalesTrackerDailyRow alloc] initWithFrame:CGRectMake(0, yOffset, 375.0, 26)];
thisRow.titleLabel.text = [NSString stringWithFormat:@"ZN%@",[zoneDict valueForKey:@"ZoneID"]];
thisRow.objLabel.text = [formatter stringFromNumber:[NSNumber numberWithFloat:[[[[zoneDict objectForKey:@"DetailSubtotals"] objectForKey:@"MonthEndProjectionDetail"] objectForKey:@"Objective"] floatValue]]];
thisRow.actLabel.text = [formatter stringFromNumber:[NSNumber numberWithFloat:[[[[zoneDict objectForKey:@"DetailSubtotals"] objectForKey:@"MonthEndProjectionDetail"] objectForKey:@"Actual"] floatValue]]];
thisRow.varLabel.text = [formatter stringFromNumber:[NSNumber numberWithFloat:[[[[zoneDict objectForKey:@"DetailSubtotals"] objectForKey:@"MonthEndProjectionDetail"] objectForKey:@"Variance"] floatValue]]];
[thisRow setBackgroundColor:[UIColor blackColor]];
[thisRow.titleLabel setTextColor:[UIColor whiteColor]];
[thisRow.objLabel setTextColor:[UIColor whiteColor]];
[thisRow.actLabel setTextColor:[UIColor whiteColor]];
[thisRow.varLabel setTextColor:[UIColor whiteColor]];

if ([thisRow.actLabel.text isEqualToString:@"0"]) {
    thisRow.varLabel.text = @"n/a";
}
if ([thisRow.varLabel.text containsString:@"-"]) {
    thisRow.varLabel.textColor = [UIColor redColor];
}
[viewSummary addSubview:thisRow];

我很难过。任何帮助将不胜感激。

0 个答案:

没有答案