我有一个包含自定义单元格标签的表视图。我想将此标签的字体更改为“Roboto-Bold”。但是它没有起作用(仍然是相同的默认字体)。我到目前为止所做的事情:
- 下载了“Roboto-Bold.ttf”
- 将字体添加到我的项目中
- 修改info.plist,添加:应用程序提供的字体,item0 = Roboto-Bold.ttf
- 添加了这段代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
EventOptionCell *cell = (EventOptionCell *)[tableView dequeueReusableCellWithIdentifier:@"EventOptionCell"];
switch (indexPath.row) {
case 0:
cell.optionLabel.text = @"TEST NEW FONT";
cell.optionLabel.font = [UIFont fontWithName:@"Roboto-Bold" size:20];
cell.imageView.image = [UIImage imageNamed:@"icon-test.png"];
break;
default:
break;
}
return cell;
}