This is my code to populate a tableview:
- (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
{
}
When tapped on the cell the label or the label text disappears in iOS7. It works on all other iOS versions. Any pointers to resolve this issue?
在您的UITableViewCell
:
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.