Add image to alert view

后端 未结 5 1787
鱼传尺愫
鱼传尺愫 2021-02-02 12:08

I have an alert view that pops up when the user press the add button. How do i add an image to the alert view?

I added some code that i took reference from stack overfl

5条回答
  •  北恋
    北恋 (楼主)
    2021-02-02 12:50

    Yes, you can add a UIImageView as a subview to your alert view.

    var imageView = UIImageView(frame: CGRect(x: 220, y: 10, width: 40, height: 40))
    imageView.image = yourImage
    
    alert.view.addSubview(imageView)
    

提交回复
热议问题