Reputation: 1951
I dragged five images into my supporting files folder.
I tried to drag and drop them from my file panel into the interface builder, but XCode would not let me do so. Do I need to perform an action with something called an "UIImageView"?
How do I add images into interface builder? Thank you, this is my first time programming in XCode.
Upvotes: 12
Views: 19577
Reputation: 1
It's not that hard for me. You just first get the image into Xcode and then open interface builder. Then find the image well object in the library and drag it into the window to where you want it to be. Finally just type in the name of the image WITHOUT EXTENSION into the image text box on the right side in image view.
Upvotes: 0
Reputation: 130183
If you drag and drop the images from the "Media Library" section of the Utilities panel directly onto your view, they will automatically create the UIImageView
and allow you to drop them directly in as illustrated below.
Upvotes: 18
Reputation: 12367
There's no way you drag and drop plain images into IB. To display images you need a UIImageView object. That's what you will find in Interface Builder. Just drag and drop a UIImageView into the view of controller. UIImageView has image property.From the drop down list of that property you will find the images you added to your project group.Pick any image and that's it. Do not forget that UIImageView can hold only one image in its image property. It's not an NSArray of images. So in case you want to kinda"import" all the images, you'll have to add that many image views to your view.
Upvotes: 1
Reputation: 18488
You can select your UIImageView
in Interface Builder, and then open the attributes inspector, to do so in XCode you will see 3 types of views select the one that opens the panel to the right, then it is the one that looks kinda like a shield, expand Image View, and you can select your image in the drop down box for "Image".
Upvotes: 3