出于对我的应用程序目的非常重要的目的,我在UIWebView中的HTML表格中显示文本内容。以下是HTML的示例:
<table width = "100%">
<tbody>
<tr>//Row 1
<td>
<div id = "guid">
Here is the text of the first row, first cell in the table
</div>
</td>
<td>
<div id = "guid">
Here is the text of the first row, second cell in the row
</div>
</td>
</tr>
<tr>//Row 2
<td>
<div id = "guid">
Here is the text of the second row, first cell in the row
</div>
</td>
<td>
<div id = "guid">
Here is the text of the second row, second cell in the row
</div>
</td>
</tr>
</tbody>
</table>
同样,我似乎不需要使用表格,但它对于应用程序的其他功能至关重要 - 可以将更多s添加到同一行。
我正在尝试向我的应用添加一个突出显示工具,由于我正在使用表格,因此遇到了一些问题。这是我想要做出的选择类型的一个例子(相同的结构,不同的内容):
选择完成后,使用execCommand
很容易为文本设置突出显示。如果只有一列数据,那就很容易了。看一看当我尝试突出我上面做出的选择时会发生什么:
突出显示另一列的细胞!我使用表的原因是我需要确保行中的每个文本块(在tr / td标记内)同时开始,即使它们可能具有不同的高度,并且可能比另一方面,使行更高。这种方法确保了行级的统一性。
任何人都有任何想法我可以做些什么来解决这个问题?