In order to make text of button fit the width of the button I can use the following code:
1 |
<span class="pln">myButton</span><span class="pun">.</span><span class="pln">titleLabel</span><span class="pun">.</span><span class="pln">adjustsFontSizeToFitWidth </span><span class="pun">=</span><span class="pln"> true</span> |
This code allows us to perfom our pages in our dear html-style:
1 2 3 4 5 6 7 8 9 |
let attrStr = try! NSAttributedString( data: "<h2>Вот это</h2>списочек:<ol><li>первое;</li><li>второе;</li><li>третье;</li></ol><strong>Это жирным</strong><br><span style='color: #800000;'>А это цветным</span><div>new </div>".data(using: String.Encoding.unicode, allowLossyConversion: true)!, options: [ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType], documentAttributes: nil) lbl.attributedText = attrStr |
Well, I’ve found several ways to enlarge the text (it was too small for me).
The best way is to put several tags <big> before the text and several </big> after the text. We can also apply UIFont like:
1 |
// txtDescribtion.font = UIFont (name: "Helvetica Neue", size: 16) |
but this way we can’t set different size for different words in the text – all the text will be the same size (16 in this example).
Well, It seems there is a more ease way to set html:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import UIKit import WebKit class MenuViewController: UIViewController { @IBOutlet weak var NewWebView: WKWebView! override func viewDidLoad() { super.viewDidLoad() NewWebView.loadHTMLString("<html><body><p>Hello!</p></body></html>", baseURL: nil) |
The new problem was in black space above the content. Diar stack gave the answer how to fix. The last variant was:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import UIKit import WebKit class DescribtionViewController: UIViewController, WKUIDelegate { @IBOutlet weak var wkDescribtionOUTLET: WKWebView! var descriptionOfTag = "no describtion" override func viewDidLoad() { super.viewDidLoad() wkDescribtionOUTLET.loadHTMLString(descriptionOfTag, baseURL: nil) wkDescribtionOUTLET.scrollView.contentInset = UIEdgeInsetsMake(-64, 0,0, 0) |
the report objc[2373]: Class PLBuildVersion is implemented in both /Applications/ stayed, but the reaction of app became much faster.
And one thing more. Now the internal links work.