标签未出现在表格单元格中

时间:2010-11-12 13:21:48

标签: iphone objective-c cocoa-touch

我的标签没有出现时出现问题。但滑块确实如此。其中一个奇怪的案例似乎没有逻辑上的原因。有人能理解这个吗?

else if (indexPath.row == 4) 
{
    Filters *filters = [Filters sharedInstance];

    CGRect frame = CGRectMake(100, 10, 80, 23);
    costSlider = [[[UISlider alloc] initWithFrame:frame] autorelease];
    costSlider.maximumValue =  [[NSNumber numberWithDouble: 
 filters.maxCarRentalCost] floatValue];
    costSlider.minimumValue = [[NSNumber numberWithDouble: 
 filters.minCarRentalCost] floatValue];
    [costSlider addTarget:self action:@selector(costSliderChanged:) 
 forControlEvents:UIControlEventValueChanged];
    [costSlider setValue:[filters.maxCarCostPerDay floatValue] animated:YES ];
    costSlider.continuous = NO;
    costSlider.enabled = YES;
    costSlider.value = [filters.maxCarCostPerDay floatValue];
    costSlider.tag = 5;     
    [cell addSubview:costSlider];

    self.costLabel.textColor = [UIColor greenColor];
    self.costLabel.text = @"what"; //[NSString stringWithFormat:@"Cost per day: 
 %d", filters.maxCarCostPerDay ];        
    [self.costLabel setBackgroundColor:[UIColor blueColor]];
    self.costLabel.frame = CGRectMake(10, 10, 75, 20);
    [self.costLabel setFont:[UIFont boldSystemFontOfSize:10.0]];
    [cell addSubview:self.costLabel];

} 

由于 -code

1 个答案:

答案 0 :(得分:2)

根据您发布的代码,您的标签看起来不像alloc。除非您在代码中的其他位置执行此操作,否则这可能是您的问题