问题
I'm very new to Xcode (2 days) and so far I'm finding it fairly frustrating. I'm just trying to add an image to my app's ViewController via he Storyboard, but it does not appear on the simulator. Could someone assist me?
回答1:
- if you are trying an example project of XCode, you may find a "Images.xcassets" folder in project. Drag your image into this folder.
- then go to storyboard, focus on your "Image View".
- in the attributes list, "Image" field, you can choose the image in it's drop-down menu.
- the try running in simulator
good luck!
回答2:
Here are some details on xcode 10.
Edit the story board, create an image view. Wayne stated, add the image you want in the Images.xcassets.
Click on your image view:
- Do View -> Inspectors -> Show Attribute Inspector
- Select the image:
回答3:
After loading your image in the " Assets.xcassets" folder you will need to find the "Attributes inspector" under your right side inspectors tab. Focus or click on your "Image view" that you have to place as a holder on the storyboard. On the right tab under the attributes inspector (looks like a down arrow next to the ruler) you can select your image from the drop-down selection. You may also want to change Content mode to Aspect Fit while you are there.
来源:https://stackoverflow.com/questions/29113415/how-to-successfully-add-an-image-in-storyboard-in-xcode-6-in-swift