简体   繁体   中英

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

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.
  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!

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:

在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM