UILabel不显示

时间:2019-10-11 03:32:34

标签: ios swift

我的情节提要中有UILabel想显示很长的字符串,但没有显示。

当我插入一个“ hello world”时,它会显示。但是,插入一个我想显示的长字符串,这没有用。

import UIKit

class VersionInformationViewController: UIViewController {

    @IBOutlet weak var version: UILabel!
    static func instantiateViewController() -> VersionInformationViewController {
        let storyboard = UIStoryboard(name: "VersionInformation", bundle: nil)
        let vc = storyboard.instantiateViewController(withIdentifier: "versionInformation") as! VersionInformationViewController
        return vc
    }

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        fetchLibraryLicense()

    }

    // MARK: - private
    private func fetchLibraryLicense(){
        var VersionInformation:String = "";
        let dictionary = NSDictionary(contentsOfFile: Bundle.main.path(forResource: "CarthageLicenseList", ofType: "plist")!);
        let array = dictionary?["PreferenceSpecifiers"] as! NSArray

        for dic in array {
            let dictionary = dic as! NSDictionary
            let title:String = (dictionary["Title"] as? String)!
            let footerText:String = (dictionary["FooterText"] as? String)!

            VersionInformation = VersionInformation + title + footerText
        }
        print(VersionInformation)
        version.text = "hello world" //it works
        version.text = VersionInformation // it did not work
    }

}

0 个答案:

没有答案
相关问题