如何为我的应用创建服务条款页面

时间:2016-12-13 10:08:38

标签: ios swift

我想为我的应用创建服务条款页面,如何显示我的页面,如下图所示? (文本可滚动)。

enter image description here

1 个答案:

答案 0 :(得分:0)

<code>enter image description here</code>

let encodedString: String = "<html><head></head><body><ul><li><input type='image' name='input1' value='string1value' class='abc' /></li><li><input type='image' name='input2' value='string2value' class='def' /></li></ul><span class='spantext'><b>Hello World 1</b></span><span class='spantext'><b>Hello World 2</b></span><a href='example.com'>example(English)</a><a href='example.co.jp'>example(JP)</a></body>";

    let encodedData = encodedString.dataUsingEncoding(NSUTF8StringEncoding)!
    let attributedOptions : [String: AnyObject] = [
        NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,
        NSCharacterEncodingDocumentAttribute: NSUTF8StringEncoding
    ]

    let attrStr = try! NSAttributedString(data: encodedData, options: attributedOptions, documentAttributes: nil)
    print(attrStr)
    textView.attributedText = attrStr
相关问题