How can I change the image displayed in a UIImageView programmatically?

后端 未结 15 689
孤街浪徒
孤街浪徒 2020-12-07 08:42

I have an IBOutlet to a UIImageView, but when I look at the UIImageView doc, I can\'t see any hints about programmatically changing it

15条回答
  •  温柔的废话
    2020-12-07 09:08

    Following Jordan's advice (which should work actually), try to set the UIImageView to be visible:

     [imageView setHidden: NO];
    

    and also - don't forget to attach it to the main UIView:

    [mainView addSubview: imageView];
    

    and to bring to the front:

    [mainView bringSubviewToFront: imageView];
    

    Hope combining all these steps will help you solve the mystery.

提交回复
热议问题