How to successfully add an image in Storyboard in Xcode 6 in Swift?

…衆ロ難τιáo~ 提交于 2020-07-03 02:23:08

问题


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:


  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.
  2. then go to storyboard, focus on your "Image View".
  3. in the attributes list, "Image" field, you can choose the image in it's drop-down menu.
  4. the try running in simulator

good luck!




回答2:


Here are some details on xcode 10.

  1. Edit the story board, create an image view. Wayne stated, add the image you want in the Images.xcassets.

  2. Click on your image view:

  1. Do View -> Inspectors -> Show Attribute Inspector
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!