简体   繁体   中英

Using Attributed text in UITextView

I'm creating a static Getting Started Guide using a UITextView in Interface Builder using .Xib files.

I've added a bunch of formatted text onto here and it looks fine in Interface Builder:

在此输入图像描述

However when I run it on my iPhone or Simulator I see this:

在此输入图像描述

Fonts have been added to the plist: 在此输入图像描述

在此输入图像描述

Why is the text not being displayed as I expected it would?

Not able to get the UITextView to work so I decided to solve it like this (using a UIWebView and hosting a HTML formatted webpage):

override func viewDidLoad() {
    super.viewDidLoad()

    webView.opaque = false;
    webView.backgroundColor = UIColor.clearColor();

    let url = NSURL (string: "https://mysecreturl.com");
    let requestObj = NSURLRequest(URL: url!);
    webView.loadRequest(requestObj);
}

Not ideal but it works for now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM