我使用以下代碼來顯示的UITableView
細胞,的UITableViewCell爲textLabel不可見ios7
static NSString *[email protected]"reusableIdentifier";
UITableViewCell *cell=(UITableViewCell*)[tableView dequeueReusableCellWithIdentifier:identifier];
cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
NSLog(@"%d",indexPath.row);
[cell.textLabel setText:@"hi"];
cell.textLabel.font = [UIFont fontWithName:@"Verdana" size:12.0];
[cell.textLabel sizeToFit];
cell.textLabel.transform = CGAffineTransformMakeRotation(M_PI_2);
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.textLabel.textAlignment = NSTextAlignmentCenter;
[cell.textLabel setTextColor:[UIColor blackColor]];
cell.backgroundColor=[UIColor clearColor];
cell.selectionStyle=UITableViewCellSelectionStyleBlue;
NSLog(@"textlabel frame %@",NSStringFromCGRect(cell.textLabel.frame));
return cell;
其工作正常在IOS 6,在其iOS6的表示爲textLabel,但在其ios7沒有顯示爲textLabel。
除了textLabel,在ios7中一切正常。寫sizetofit前
還有一件事,爲textLabel的框架是(0,0,0,0)
但加入sizetofit
其(0,0,12,15),即使它沒有顯示爲textLabel後。
的tableview在IOS 7 在IOS的tableview 6
試試這個cell.textLabel.contentMode = UIViewContentModeCenter; –
@CharanGiri嘗試過,但沒有工作。 – ViruMax