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

3

11

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?

Eleusis answered 18/3, 2015 at 3:0 Comment(1)
This is probably an auto layout issue. Just select your imageView at your storyboard, go to menu Editor > Resolve Auto Layout Issues > Reset to Suggested ConstraintsVogele
F
24
  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!

Forepart answered 18/3, 2015 at 3:22 Comment(1)
No idea what the "attributes list" is. I don't see any fields or headers with that label. This answer was almost exactly what I need, now that Apple seems to require a storyboard for submission.Crossroads
B
9

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:

enter image description here

  1. Do View -> Inspectors -> Show Attribute Inspector
  2. Select the image:

enter image description here

Bobbysoxer answered 12/4, 2019 at 20:0 Comment(0)
B
1

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.

Bissonnette answered 6/7, 2018 at 0:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.