图像视图和按钮未出现在模拟器中

时间:2016-08-20 20:15:33

标签: swift xcode uiimageview uibutton

当我在xcode上运行我的应用程序时,我的图像视图和按钮不会出现在模拟中。它们出现在故事​​板中,但是,它们没有出现在模拟中。我的按钮和图像视图有图像,它们是png文件。我还没有在应用程序中添加任何严重的代码,因为我想确保图像视图和按钮出现(遗憾的是它们没有出现:()。我输入的唯一代码是用于图像视图和IBActions的IBOutlets按钮(其中没有任何代码)。我目前正在运行xcode 7.3.1和swift语言的新功能。

Storyboard

//这是来自视图控制器的代码

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var SlotRectangle1: UIImageView!

    @IBOutlet weak var SlotRectangle2: UIImageView!

    @IBOutlet weak var SlotRectangle3: UIImageView!



    override func viewDidLoad() {
        super.viewDidLoad()

    }

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

    @IBAction func SlotButton1() {
    }

    @IBAction func SlotButton2() {
    }

    @IBAction func SlotButton3() {
    }
}

1 个答案:

答案 0 :(得分:0)

从错误消息中,您似乎没有正确添加图片资源,或者根本没有添加它们。

在此处查看答案:Adding Images iOS xCode

相关问题