How to load image from Images.xcassets into a UIImage with swift

后端 未结 1 560
忘掉有多难
忘掉有多难 2020-12-29 19:51

I have an image from the Images.xcassets folder and I want to load it into a UIImage programmatically using swift. How can I do this? Anyone done t

相关标签:
1条回答
  • 2020-12-29 20:09

    Here's my code:

    @IBOutlet weak var imageView: UIImageView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        imageView.image = UIImage(named: "Apple")
    }
    

    I created an image view and displayed an image inside it.

    Enjoy coding!

    0 讨论(0)
提交回复
热议问题