使用NSAttributedString进行HTML解析

在重写订单列表屏幕时,使用NSAttributedString解析HTML字符串以动态调整颜色和样式。首次解析时,iOS会启动WebKit和相关模块,导致显著延迟,但后续解析会快得多。连续解析每个单元格仍可能导致滚动延迟,应尽量避免。由于使用NSAttributedString解析HTML不是线程安全的,所以必须在主线程执行,可能需要显示加载指示器或预先解析HTML。
摘要由CSDN通过智能技术生成

When we decided to rewrite and redesign the orders list screen, we also wanted to use small pieces of html strings for some part of each order cell information we provide. This approach could give us little freedom to change colors, fonts, order statuses etc. dynamically. This means, we need to parse multiple html strings for every cell.

当我们决定重写和重新设计订单列表屏幕时,我们还希望对提供的每个订单单元信息的某些部分使用一小段html字符串。 这种方法可能给我们几乎没有自由来动态更改颜色,字体,订单状态等。 这意味着,我们需要为每个单元格解析多个html字符串。

We started to face a few issues at that point, since the “every cell” is the important keyword here. As we used to configure table cells with mostly prepared data, we just pass the required data to cell classes, inside the cellForRow delegate method.

那时我们开始面临一些问题,因为“每个单元”是这里的重要关键字。 当我们使用大多数准备的数据来配置表单元格时,我们只是将所需的数据传递到cellForRow委托方法内部的单元格类

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值