objective-c – UITableViewCell不会突出显示

前端之家收集整理的这篇文章主要介绍了objective-c – UITableViewCell不会突出显示前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
出于某种原因,我的UITableViewCells都没有突出显示蓝色.在IB中,我将其设置为突出显示蓝色,并且我没有覆盖IB的代码.

你注意到可能导致这种情况的任何事情吗?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    int showID = [[[singleton.programs objectAtIndex:indexPath.row]objectForKey:@"id"]intValue];
    //creates the url and loads the list of products
    //NSLog(@"showID: %d",showID);
    URLCreator * productsURL = [[URLCreator alloc] initStandard:@"getProgramProductsForList"];
    [productsURL addParam:@"id" stringValue:[NSString stringWithFormat:@"%d",showID]];
    WebManager *productsWM = [[WebManager alloc]init];
    [productsWM load:[productsURL finalURL] withSelector:@selector(parseProducts) object:[NSNumber numberWithInt:showID]];
}

除了`@ property / @ synthesize @之外,我的自定义单元格目前还没有任何内容,但现在它是.

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

解决方法

你的情况很简单,解决它的最佳方法可能是制作一个正常工作的最小例子(带蓝色选择的默认表格视图单元格)并逐步添加(或二进制搜索步骤)直到它中断.

如果在添加一些内容后最小代码中断,那么您就可以找到问题所在.如果没有,并且您实际上已经达到了您在项目中使用的相同的东西,请比较并查看您没有注意到的差异.

猜你在找的Xcode相关文章