Questions tagged [uiimageview]

An image view object provides a view-based container for displaying either a single image or for animating a series of images in iOS. For animating the images, the UIImageView class provides controls to set the duration and frequency of the animation. You can also start and stop the animation freely.

UIImageView is available in iOS 2.0 and later. New image view objects are configured to disregard user events by default. If you want to handle events in a custom subclass of UIImageView, you must explicitly change the value of the userInteractionEnabled property to YES after initializing the object. The question related can be tagged using .

When a UIImageView object displays one of its images, the actual behavior is based on the properties of the image and the view. If either of the image’s leftCapWidth or topCapHeight properties are non-zero, then the image is stretched according to the values in those properties. Otherwise, the image is scaled, sized to fit, or positioned in the image view according to the contentMode property of the view. It is recommended (but not required) that you use images that are all the same size. If the images are different sizes, each will be adjusted to fit separately based on that mode.

All images associated with a UIImageView object should use the same scale. If your application uses images with different scales, they may render incorrectly.

UIImage Class Reference

Resource:

Questions in Stack Overflow related to UIImageView:

Sample:

UIImageView *myImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
//Allocating imageView and set its frame.

myImage.image = [UIImage imageNamed:@"myImage.png"];
//add image into imageview

[self.view addSubview:myImage];
// add imageview into your viewcontroller's view
10625 questions
2
votes
3 answers

How to add UITextView as a subview to UIImageView on interface builder?

I have created a UIImageView and I want to add a UITextView as a subview beneath the image. Is there any way that I can configure this using the Interface Builder instead of hardcoding it? If not, in which part of the code should I insert the…
Hayley
  • 51
  • 1
  • 4
2
votes
1 answer

Get visible part of UIImageView as UIImage in Swift

In my app, I'm trying to implement a crop feature. So now I need to convert UIImageView's visible part to UIImage. Here's a screenshot from the UI debugger. I've tried to achieve it with this function, but it doesn't work. func…
Sam
  • 488
  • 1
  • 5
  • 14
2
votes
1 answer

Problem scaling UIImageView with Pinch Gesture

I have a program that creates a small UIImageView that responds to touch so you can drag it around the superview. I added a UIPinchGestureRecognizer in order to Scale the image up and down. With the current code, the image scales up and down…
REDMX
  • 157
  • 2
  • 10
2
votes
2 answers

iPad Content Scale Factor x2 for iPhone application

I'm hoping to recursively change every single View in my application to use the iPhone 4 graphics, and change the content scale factor to 2.0, such that it's the zoomed in version of my iPhone application on the iPad by default. Currently, the iPad…
David van Dugteren
  • 3,879
  • 9
  • 33
  • 48
2
votes
1 answer

I can't see app icon images on main.storyboard -> UIImageView -> image scope on Xcode

I am really new to Xcode and Swift so I think there is an easy fix but couldn't find it. Here are the screenshots. In this screenshot there should be the diamond images which you can see in the second screenshot inside the red circle to use for…
Anon J
  • 23
  • 4
2
votes
2 answers

problem with timer animation

here is what I wanna do http://www.youtube.com/watch?v=rD3MTTPaK98 I have done the part where an image appears at a random position but then it become hard for me. I don't wanna use UIKit Animations because I use a timer to animate like…
bernard langue
  • 147
  • 1
  • 10
2
votes
3 answers

Why this image link not showing up in UIimageView in ios?

Why this image link not showing up in UIimageView in ios ? var url = URL(string: "https://bill.ps/uploads/32065621a012e53f749c15b0a8468d71swift_file5486.png") Code func fetchImage(_ photoURL: URL?) { guard let imageURL = photoURL else { return…
2
votes
3 answers

UIImageView and Window Orientation Problem

WHAT I WANT TO DO What I want is an imageview on top of the application, which I can control it's appearance. For example, in the homepage I don't want the banner, but in another view I do. That means that if I do want to have the banner, I have to…
jylee
  • 833
  • 2
  • 8
  • 15
2
votes
1 answer

How to Rotate a UIimage view to the point at which you touched the screen?

Im currently using IOS swift and I'm having trouble rotating the image view that I have on my screen to the point at which I touch the screen, So if tap directly underneath the image, it rotates 180 degrees to point at the touch point. Here is the…
2
votes
1 answer

Detect collision between multiple UIImageViews that are animated with the same name

I am trying to detect the collision between a falling/animated UIImageView that is created every second with an NSTimer. Here's the code: -(void)newobject{ int randomx = 76+ arc4random() %(290); int randomDuration = 2+ arc4random() %(6); …
Jean Pierre
  • 201
  • 5
  • 17
2
votes
2 answers

how set tag of images in image view?

- (void)viewDidLoad { UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapDetected:)]; tapGesture.numberOfTapsRequired = 1; tapGesture.numberOfTouchesRequired =…
ram
  • 1,193
  • 1
  • 15
  • 27
2
votes
2 answers

How to cache images in Objective-C

I want to create a method to cache an image from an URL, I got the code in Swift since I had used it before, how can I do something similar to this in Objective-C: import UIKit let imageCache: NSCache = NSCache() extension…
Didami
  • 210
  • 2
  • 14
2
votes
3 answers

Merging a previosly rotated by gesture UIImageView with another one. WYS is not WYG

I'm getting crazy while trying to merge two UIImageView. The situation: a background UIImageView (userPhotoImageView) an overlayed UIImageView (productPhotoImageView) that can be streched, pinched and rotated I call my function on the UIImages…
Giuliano Iacobelli
  • 1,010
  • 1
  • 8
  • 21
2
votes
1 answer

UIImageView in UICollectionViewCell randomly changing frame when using SF Symbol as image source

I have a UIImageView in a UICollectionViewCell. I am using auto layout to set it to the top left of the cell with fixed width and height. When I set the image on the image view, from an image in the asset catalog, things work great. When I set the…
zumzum
  • 17,984
  • 26
  • 111
  • 172
2
votes
3 answers

Images do not show up when I run my app on iOS device

I have images titled like so in my app: image~iPhone.png image@2x~iPhone.png In interface builder I am loading image.png into my UIImageView. I also programatically load some images into a different view using imageWithContentsOfFile. The images…
clintsmith
  • 695
  • 6
  • 16