构建成功但运行时内容不会出现

时间:2017-09-03 11:02:07

标签: ios swift xcode uiviewcontroller uitextview

当我使用以下代码运行Xcode时,它表示"构建成功"但在模拟器上没有出现任何东西,我也不知道为什么。请告知解决方法。

import UIKit

class ViewController: UIViewController {

    let numberOfPlanets = 8
    let diameterOfEarth = 24859.92 // in miles, where pole to pol


    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.

        print("Welcome to solar system!")
        print("There are \(numberOfPlanets) to explore")
        print("You are currenly on the Earth, which has a circumstance of \(diameterOfEarth) miles")

        firstTextView.text = "Welcome to solar system!"


    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBOutlet weak var firstTextView: UITextView!

}

加入。 谢谢Shades enter image description here的建议。我检查了你所有的建议,但控制台还没有打印。我更改了" ViewController.swift"的名称。 to" main.swift"删除错误说"表达式不在顶层"。可能是这个原因?我添加了我的截图以便更好地理解。请帮忙。

0 个答案:

没有答案