您的位置:首页 > 产品设计 > UI/UE

IOS8 UITableViewCell.detailTextLabel不显示解决方法

2015-01-05 10:56 453 查看
在cellForRowAtIndexPath 方法返回cell之前,加上这一句 [cell layoutSubviews];

</pre></div><div><pre name="code" class="objc"> -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"detailCell";

UITableViewCell *cell = [self.contactDetailTable dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier];
}

// 解决ios8 detailTextLabel 不显示问题
//    if ([self checkOSVersion] >= 8) {  // 判断当前系统版本。(其实不判断也没问题)
[cell layoutSubviews];
//    }
return cell;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息