iOS UITextView属性为<img/>位置

时间:2016-01-14 09:03:33

标签: ios css uitextview rtf nsattributedstring

我的UITextView对象中有这个RTF:

     MysqlConn = New MySqlConnection
    MysqlConn.ConnectionString = "server=localhost;userid=root;password=**********;database=librarydb;"
    Dim SDA As New MySqlDataAdapter
    Dim bSource As New BindingSource
    Dim dbDataSet As New DataTable
    Dim ds As New DataSet
    Dim Result As MySqlDataReader
    Try
        MysqlConn.Open()
        If ComboBox2.Text = "Author" Then
            Dim Query As String
            Query = "Select quantity as 'Qty',classification as 'Classification',author as 'Author',title as 'Title',call_number as 'Call Number',isbn_number as'ISBN Number' from librarydb.blist where author like'%" & TextBox1.Text & "%'"
            COMMAND = New MySqlCommand(Query, MysqlConn)
            SDA.SelectCommand = COMMAND
            SDA.Fill(dbDataSet)
            Result = COMMAND.ExecuteReader

            Dim search As Integer
            search = 0
            While Result.Read
                search = search + 1
            End While
            If search = 1 Then
                SDA.Fill(dbDataSet)
                DataGridView1.DataSource = dbDataSet



            Else
                MsgBox("No Datafound")
                MysqlConn.Close()
            End If
        End If

结果是here

我需要在基线下移动几个像素的图像,但"Test text <img src='http://icons.kdaweb.com/commerce/png/50x30/payment_types-american_express.png'> test text. 不起作用。

如果不使用 UIWebView ,我可以对图像做什么?

SOLUTION:

一个样式属性适合我:

<img style=...>

1 个答案:

答案 0 :(得分:0)

我真的建议您使用 UIWebView 。编写img标签不会让你有很多选择。使用这个类将有助于很好地构建代码,避免任何不可维护的代码。

然后你就可以玩CSS表了,我真的更喜欢UIWebView解决方案。

修改

我不推荐但可能是(坏)解决方案的方法:使文本更大并将img高度更改为文本高度。但你需要有一个更好的形象(SVG?)。