IPhone - image in UIImageView does not appear in the simulator

I imported some PNG images into my project, and in InterfaceBuilder I add UIImageView to the view. I set the Image property to imported (by selecting it from the drop-down menu). He appears. Then I run the simulator from IB, and everything is displayed in the form, except for the image. What is the problem? I did not do anything more or more than what was said earlier.

A project is a default ViewBased project.

+4
source share
2 answers

@ You can get the image in the simulator if you work with IB. You must run the simulator from xcode. the image is in the xcode project folder not in your .xib file.

PS. If you run the iPhone simulator from IB, it will launch this particular .xib file and show you the contents added to the xib file, for example, textfiles. but he will not show you the image. if you want the image to be correct or not just change the background color of the UIImageView to something other than the default, then run the color that you selected from IB in the simulator.

Pss. click the xib file and select open as the source file in the option. to check how xib files are created.

+3
source

There was the same problem. Decision. Go to the Dimension Inspector. Change Show to the rectangle of the rectangle. Build and run. Now the image will show itself. Change Show Back is the default value.

+2
source

Source: https://habr.com/ru/post/1342380/


All Articles