class Myclass : UIView{
override func prepareForInterfaceBuilder() {
super.prepareForInterfaceBuilder()
//the image always nil
image = UIImage(named: "tag.png")
//image always nil
image = UIImage(named: "icon@2x.png")
// will show the image in the preview but not when i run it in an simulator or an actual phone
image = UIImage(contentsOfFile: "/Users/../../Images.xcassets/icon1.png")
}
}
我的问题如何在手机和模拟器上显示此图像,因为当我在路径上显示它在模拟器或实际手机上运行时会丢失图像
是的,图片在我的项目和我的目标中,我用它来做飞行菜单,它运作得很好