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

标签 ios objective-c uitableview uifont

我想在 UITableViewCellUILable 中使用不同的字体名称。我尝试了很多例子,比如:

    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

它不起作用。字体名称实际上读取了我设备的默认字体。因为如果我在这里使用一些不同的字体名称 [Cell.cellSectionLabel setFont:[UIFont fontWithName:@"Baskerville"size:16]];,它不会改变任何东西。它保持不变。在这种情况下如何使用不同的字体名称?

非常感谢。

最佳答案

您正在将其设置回系统字体。删除这一行:

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

关于ios - 如何在 UITableViewCell UILabel 中使用不同的字体名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29362484/

相关文章:

ios - 阻止 SKSpriteNode 从 "overflowing"到 SKSpriteNode 之外

iphone - 在 "Create Transaction response"中获取错误

ios - 从 Google map 到 UITableView 的选取器地点

ios - UITableView 内部错误 : unable to generate a new section map with old section count: and new section count: with userInfo (null)

ios - GMT 与夏令时更改的本地时间转换

iphone - 如何从它创建的对象中引用 Controller ?

ios - Objective-c 从两个 NSIntegers 中获得最大

ios - 发送到已释放实例的消息导致加载 UITableView 崩溃

iOS:键值观察不会消除模态视图

iphone - 避免自动释放 NSMutablearray ..... iphone 应用程序