Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 在UITableView中更改标签的字体_Iphone_Uitableview_Uifont - Fatal编程技术网

Iphone 在UITableView中更改标签的字体

Iphone 在UITableView中更改标签的字体,iphone,uitableview,uifont,Iphone,Uitableview,Uifont,我目前正在通过故事板编写一个数据库应用程序,我现在正处于让它看起来更花哨的阶段。我已将字体“Gotham.ttf”添加到带有Info.plist的应用程序中。是的,我确实把字体文件复制到了项目中 在我的ViewController.m中,我有以下代码: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSStri

我目前正在通过故事板编写一个数据库应用程序,我现在正处于让它看起来更花哨的阶段。我已将字体“
Gotham.ttf
”添加到带有Info.plist的应用程序中。是的,我确实把字体文件复制到了项目中

在我的
ViewController.m
中,我有以下代码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    
    // Cell Configuration
    NSManagedObject *device = [self.devices objectAtIndex:indexPath.row];
    [cell.textLabel setText:[NSString stringWithFormat:@"%@ %@", [device valueForKey:@"name"], [device valueForKey:@"version"]]];
    [cell.detailTextLabel setText:[device valueForKey:@"company"]];
    cell.textLabel.font = [UIFont fontWithName:@"Gotham" size:20];
    
    return cell;
}

代码中的一切都很好。我知道这一点,因为如果我将Gotham改为“Arial”或“Tahoma”,当我启动应用程序时,字体会很好。但当我尝试将标签的字体更改为“Gotham”时,它只是恢复为单元格使用的默认字体。我肯定是把字体弄错了,只是不确定哪里出了问题。

请参见此处的详细信息:

你是否完全按照所有的步骤做了


另外,您真的有文件扩展名
tff
?“true type font”应该是
ttf

好吧,我来看看,然后呢?文件是
ttf
,你看到上面的截图了吗?你在截图上面打了个错。。。等待我更正了:)是的,正如Kashiv所指出的,你在你的问题文本中写了tff,这就是我所质疑的。你在苹果提供的字体列表中没有Gotham字体。