Ios 当序列图像板标签具有自定义字体时,dequeueReusableCellWithIdentifier需要4秒钟运行

Ios 当序列图像板标签具有自定义字体时,dequeueReusableCellWithIdentifier需要4秒钟运行,ios,fonts,storyboard,Ios,Fonts,Storyboard,我有一个应用程序,它有一系列通过navigationController的pushViewController转换的视图。最后一步是推送包含tableView和tableViewCell原型的视图。完成此转换需要4秒钟,此时UI将在推送发生之前挂起 我第一次把范围缩小到对dequeueReusableCellWithIdentifier的调用。然后,我将其缩小为一个或多个标签,其中包含项目中加载的自定义字体 我可以通过将脚本字体保留为系统字体来修复它,但在代码中动态分配自定义字体 我的问题是,为

我有一个应用程序,它有一系列通过navigationController的pushViewController转换的视图。最后一步是推送包含tableView和tableViewCell原型的视图。完成此转换需要4秒钟,此时UI将在推送发生之前挂起

我第一次把范围缩小到对dequeueReusableCellWithIdentifier的调用。然后,我将其缩小为一个或多个标签,其中包含项目中加载的自定义字体

我可以通过将脚本字体保留为系统字体来修复它,但在代码中动态分配自定义字体

我的问题是,为什么在故事板中设置字体会使速度变慢,可以采取任何措施来解决这个问题吗?我更喜欢像其他属性一样在故事板中设置它

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *MyIdentifier = @"tableViewCell";

    // The next line takes 4 seconds to run 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
    if (cell == nil){
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }

    NSDictionary *data = _data[indexPath.section][indexPath.row];

    UILabel *label1 = (UILabel*)[cell viewWithTag:1];
    UILabel *label2 = (UILabel*)[cell viewWithTag:2];
    UILabel *label3 = (UILabel*)[cell viewWithTag:3];

    // Using this instead of storyboard defined fonts loads quickly
    // label1.font = [UIFont fontWithName:@"Oxygen-Bold" size:18];
    // label2.font = [UIFont fontWithName:@"OpenSans-Semibold" size:13];
    // label3.font = [UIFont fontWithName:@"OpenSans-Semibold" size:13];

    label1.text = data[@"name"];
    label2.text = data[@"subtitle"];
    label3.text = data[@"slogan"];

    return cell;
}

我花了一天的时间试图弄清楚为什么我的dequeueReusableCellWithIdentifier在iOS 8上添加新的自定义单元格需要1秒的时间(在iOS 7上–效果很好)

通过从故事板中删除自定义字体修复。非常感谢你的提示


这是苹果公司的一个错误

令我惊讶的是,在我的案例中,相反的做法解决了延迟问题。我以编程方式设置字体,并获得问题中所述的4秒延迟。我注释掉了字体设置代码,改为使用故事板,延迟消失了!