Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.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
Performance TableView中的属性文本性能问题_Performance_Ios7_Scroll_Tableview_Letterpress - Fatal编程技术网

Performance TableView中的属性文本性能问题

Performance TableView中的属性文本性能问题,performance,ios7,scroll,tableview,letterpress,Performance,Ios7,Scroll,Tableview,Letterpress,iOS7引入了一种奇妙的“活版”文本效果,通过AttributeText应用于UILabel文本。我需要在简单表格的单元格中具有这种效果 不幸的是,与“textlab.text”赋值相比,它以标准方式呈现,导致了显著的滚动滞后 属性化文本渲染似乎非常耗费CPU,但像Notes这样的iOS嵌入式应用程序滚动速度非常快。是否可以提高渲染性能 下面是代码示例: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtInd

iOS7引入了一种奇妙的“活版”文本效果,通过AttributeText应用于UILabel文本。我需要在简单表格的单元格中具有这种效果

不幸的是,与“textlab.text”赋值相比,它以标准方式呈现,导致了显著的滚动滞后

属性化文本渲染似乎非常耗费CPU,但像Notes这样的iOS嵌入式应用程序滚动速度非常快。是否可以提高渲染性能

下面是代码示例:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    MyCell *cell = (MyCell*)[tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil)
    {
        cell = [[MyCell alloc] init];
    }

    NSDictionary *attrs = @{NSTextEffectAttributeName : NSTextEffectLetterpressStyle};
    NSString *text = [self textWithCell:indexPath];

    //next line causes lags
    textLabel.attributedText = [[NSMutableAttributedString alloc] initWithString:text attributes:attrs];

    //this works fine
    //cell.textLabel.text = text;
  }

这个@mix有什么好运气吗?它不仅在表视图单元格中,即使只有一个标签具有这种效果,它也会显著延长新视图控制器的初始化时间。只有在使用
NSTextEffectLetterpressStyle
时,其他属性化字符串才没有此问题。我会提交一份性能非常差的bug报告。