Для этого вам нужно создать собственную ячейку. как это,
в файле CustomCellTableViewCell.h
#import <UIKit/UIKit.h>
@interface CustomCellTableViewCell : UITableViewCell
@property(nonatomic,strong)UILabel *lblUnit;
@end
in CustomCellTableViewCell.m file
#import "CustomCellTableViewCell.h"
@implementation CustomCellTableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
self.userInteractionEnabled = YES;
if (self) {
// Initialization code
self.lblUnit = [[UILabel alloc]init];
[self.lblUnit setTextColor:[UIColor whiteColor]];
[self.lblUnit setFont:[UIFont fontWithName:@"Roboto-Light" size:30.0f]];
// [self.lblUnit setFont:[UIFont systemFontOfSize:18.0]];
self.lblUnit.textAlignment = UIBaselineAdjustmentAlignCenters;
self.lblUnit.adjustsFontSizeToFitWidth = YES;
[self.contentView addSubview:self.lblUnit];
}
return self;
}
@end
in your Tableview CellForRowAtIndexpath write below code
cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if(cell==nil){
cell = [[CustomCellTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
}
cell.lblUnit.frame = CGRectMake(0, 10, 150, 40);
cell.lblUnit.text = @"Hai";
return cell;