[英]labeltext in the tableview cell disappears when tapped on the cell only in iOS 7
這是我用來填充表格視圖的代碼:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
CellIdentifier = @"lcell~iphone";
} else
{
CellIdentifier = @"lcell";
}
lcell *stockCell = (lcell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (stockCell == nil)
{
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:CellIdentifier owner:self options:nil];
NSLog(@"CEll loaded1");
for (id currentObject in topLevelObjects)
{
if ([currentObject isKindOfClass:[UITableViewCell class]])
{
stockCell = (lcell *) currentObject;
NSLog(@"CEll loaded2");
break;
}
}
}
//Here setting the label text andg getting the label text of all cells correct even in ios7
stockCell.headerlabel.text= [[self.reserveArr objectAtIndex:indexPath.row] title];
NSLog(@"title %@",[[self.reserveArr objectAtIndex:indexPath.row] title]);
stockCell.headerlabel.tag=indexPath.row;
stockCell.headerlabel.numberOfLines = 1;
stockCell.headerlabel.adjustsFontSizeToFitWidth = YES;
stockCell.headerlabel.minimumFontSize = 0;
stockCell.headerlabel.numberOfLines=2;
return stockCell;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
[cell setBackgroundColor:[UIColor clearColor]];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
}
在單元格上點擊時,標簽或標簽文本在iOS7中消失。 它適用於所有其他iOS版本。 有解決此問題的指針嗎?
在您的UITableViewCell
:
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.