如何在UITableViewCell UILabel中使用不同的字体名称

时间:2015-03-31 06:59:16

标签: ios objective-c uitableview uifont

我想在UILable的{​​{1}}中使用不同的字体名称。我尝试了很多例子:

UITableViewCell
Cell.cellSectionLabel.text = [self.textsInTableSection objectAtIndex:0]; Cell.cellSectionImageView.image = [UIImage imageNamed:[self.imagesInTableSection objectAtIndex:0]]; Cell.cellSectionLabel.textColor = [UIColor colorWithRed:59.0f/255.0f green:56.0f/255.0f blue:62.0f/255.0f alpha:1.0f]; [Cell.cellSectionLabel setFont:[UIFont fontWithName:@"Helvetica" size:16]]; Cell.cellSectionLabel.font = [UIFont systemFontOfSize:16];

中的

它不起作用。字体名称实际上读取了我的设备的默认字体。因为如果我在cellForRowAtIndexPath使用一些不同的字体名称,它不会改变任何东西。它保持不变。在这种情况下如何使用不同的字体名称?

提前多多感谢。

2 个答案:

答案 0 :(得分:1)

您将其重新设置为系统字体。删除这一行:

Cell.cellSectionLabel.font = [UIFont systemFontOfSize:16];

答案 1 :(得分:0)

Please remove the last line of your code and try again.
Cell.cellSectionLabel.font = [UIFont systemFontOfSize:16];

According to your code you are setting font to Helvetica 16 
& again changing it back to System font