【问题标题】:Image views and buttons not appearing in the simulator模拟器中未出现图像视图和按钮
【发布时间】:2016-08-20 20:15:32
【问题描述】:

当我在 xcode 上运行我的应用程序时,我的图像视图和按钮不会出现在模拟中。它们出现在故事​​板中,但是,它们没有出现在模拟中。我的按钮和图像视图有图像,它们是 png 文件。我还没有在应用程序中添加任何严肃的代码,因为我想确保图像视图和按钮出现(遗憾的是它们没有出现:()。我输入的唯一代码是图像视图的 IBOutlets 和 IBActions按钮(其中没有任何代码)。我目前正在运行 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() {
    }
}

【问题讨论】:

  • 根据情节提要,您遇到了崩溃...这是什么崩溃?

标签: swift xcode uiimageview uibutton


【解决方案1】:

从错误消息看来,您要么没有正确添加图像资源,要么根本没有添加它们。

在这里查看答案:Adding Images iOS xCode

【讨论】:

  • 非常感谢!
猜你喜欢
  • 2023-03-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多