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
Filter by
Sorted by
Tagged with
309 votes
35 answers
83k views

UIImageView missing images in Launch Screen on device

I have an app that supports iOS8 and later, built in Xcode 7 and I am using a XIB for a Launch Screen (I do not have launch images). The view contains a single UILabel with the app version, and 2 ...
MFW's user avatar
  • 3,101
230 votes
12 answers
209k views

How to assign an action for UIImageView object in Swift

I'm trying to assign an UIImageView to an action when the user taps it. I know how to create an action for a UIButton, but how could I mimic the same behavior of a UIButton, but using a UIImageView?
user3706773's user avatar
  • 3,019
229 votes
15 answers
160k views

How to animate the change of image in an UIImageView?

I have an UIImageView with an image. Now I have a completely new image (graphic file), and want to display that in this UIImageView. If I just set myImageView.image = newImage; the new image is ...
dontWatchMyProfile's user avatar
203 votes
10 answers
339k views

UIImageView aspect fit and center

I have an image view, declared programmatically, and I am setting its image, also programmatically. However, I find myself unable to set the image to both fit the aspect and align centre to the image ...
Ravi Vooda's user avatar
  • 5,256
186 votes
8 answers
110k views

UIGestureRecognizer on UIImageView

I have a UIImageView, which I want to be able to resize and rotate etc. Can a UIGestureRecognizer be added to the UIImageView? I would want to add a rotate and pinch recognizer to a UIImageView ...
some_id's user avatar
  • 29.6k
167 votes
10 answers
97k views

Fade/dissolve when changing UIImageView's image

Rather than creating two UIImageViews, it seems logical to simply change the image of one view. If I do that, is there anyway of having a fade/cross dissolve between the two images rather than an ...
Josh Kahane's user avatar
159 votes
3 answers
110k views

Difference between UIViewContentModeScaleAspectFit and UIViewContentModeScaleToFill?

what is the difference between UIViewContentModeScaleAspectFit and UIViewContentModeScaleToFill...?
Madhumitha's user avatar
  • 3,794
156 votes
28 answers
84k views

Center content of UIScrollView when smaller

I have a UIImageView inside a UIScrollView which I use for zooming and scrolling. If the image / content of the scroll view is bigger than the scroll view, everything works fine. However, when the ...
hpique's user avatar
  • 120k
144 votes
6 answers
56k views

UIViewContentModeScaleAspectFill not clipping

I'm trying to draw some thumbnail images at a fixed size (100x100) using UIImageView. I've set the frame size of my image view to be 100x100, and set the contentMode to ...
Josh Buhler's user avatar
  • 27.3k
142 votes
13 answers
105k views

Setting Corner Radius on UIImageView not working

I'm at a bit of a loss. I've used the layer property of UIView to round the corners of multiple elements in my app. However, this one UIImageView is simply not complying. Not sure what I am missing. ...
MarkPowell's user avatar
  • 16.5k
137 votes
15 answers
283k views

How can I change the image displayed in a UIImageView programmatically?

I have an IBOutlet to a UIImageView, but when I look at the UIImageView doc, I can't see any hints about programmatically changing it. Do I have to fetch an UIImage object from that UIImageView?
Thanks's user avatar
  • 40.3k
133 votes
9 answers
90k views

Using Tint color on UIImageView

I have my own subclass of UIButton. I add UIImageView on it and add an image. I would like to paint it over the image with a tint color but it doesn't work. So far I have: - (id)initWithFrame:(...
Marko Zadravec's user avatar
133 votes
9 answers
290k views

How do you create a UIImage View Programmatically - Swift

I'm trying to create a UIImage View programmatically, I have a new view and I tried doing this let imageName = "yourImage.png" yourview.backgroundColor = UIColor.colorWithPatternImage(UIImage(named:...
alex's user avatar
  • 1,776
132 votes
20 answers
56k views

How to compare UIColors?

I'd like to check the color set for a background on a UIImageView. I've tried: if(myimage.backgroundColor == [UIColor greenColor]){ ...} else{ ...} but that doesn't work, even when I know the color ...
4thSpace's user avatar
  • 44.1k
130 votes
16 answers
113k views

How can I take an UIImage and give it a black border?

How can I set the border of a UIImage?
Shay's user avatar
  • 2,595
118 votes
2 answers
31k views

Dispelling the UIImage imageNamed: FUD

Edit Feb 2014: Note that this question dates from iOS 2.0! Image requirements and handling have moved on a lot since then. Retina makes images bigger and loading them slightly more complex. With the ...
Rog's user avatar
  • 17.2k
117 votes
6 answers
99k views

Save An Image To Application Documents Folder From UIView On IOS

I have a UIImageView that allows a user to place and hold an image until it can be saved. The problem is, I can't figure out how to actually save and retrieve the image I've placed in the view. I ...
forgot's user avatar
  • 2,160
112 votes
17 answers
137k views

How do I make UITableViewCell's ImageView a fixed size even when the image is smaller

I have a bunch of images I am using for cell's image views, they are all no bigger than 50x50. e.g. 40x50, 50x32, 20x37 ..... When I load the table view, the text doesn't line up because the width ...
Robert's user avatar
  • 38k
103 votes
8 answers
96k views

Click Event on UIImageView programmatically in ios

I am displaying a image from code here is the code UIImageView *preArrowImage =[[UIImageView alloc]init ]; preArrowImage.image =[UIImage imageNamed:@"arrowprev.png"]; preArrowImage.frame = CGRectMake(...
Sumit Patel's user avatar
  • 2,567
98 votes
10 answers
130k views

How can I detect the touch event of an UIImageView?

I have placed an image (UIImageView) on the navigation bar. Now I want to detect the touch event and want to handle the event. How can I do that?
ebaccount's user avatar
  • 5,051
98 votes
9 answers
201k views

How to load GIF image in Swift?

I have a String with an URL of GIF banner which I need to put into app. My code: func showAdd(){ Request.get("http://www.kyst.no/api/?apiMode=advertisement&lang=no", { (error: NSError?, ...
Marius's user avatar
  • 994
94 votes
4 answers
67k views

How to cancel UIView block-based animation?

I've searched loads of SO stuff and in Apple's references, but still unable to manage my problem. What I have: A screen with 2 UIImageViews and 2 UIButtons connected to them 2 kinds of animation: ...
raistlin's user avatar
  • 4,318
91 votes
16 answers
154k views

How to set image in circle in swift

How can i make i circle picture with swift ? My ViewController : import UIKit import Foundation class FriendsViewController : UIViewController{ @IBOutlet weak var profilPicture: UIImageView! ...
Pixel's user avatar
  • 1,966
91 votes
14 answers
134k views

UIImageView pinch zoom swift

I was hoping someone could help me out. I am trying to allow a user to pinch zoom on a UIImageView(with a max and min level allowed). But for some reason the it does not work right. The image zooms a ...
RandomBytes's user avatar
  • 1,831
89 votes
9 answers
124k views

How to set the opacity/alpha of a UIImage?

I know you can do this with a UIImageView, but can it be done to a UIImage? I want to have the animation images array property of a UIImageView to be an array of the same image but with different ...
Marty's user avatar
  • 6,024
87 votes
14 answers
119k views

iOS - UIImageView - how to handle UIImage image orientation

Is it possible to setup UIImageView to handle image orientation? When I set the UIImageView to image with orientation RIGHT (it is photo from camera roll), the image is rotated to right, but I want to ...
Martin Pilch's user avatar
  • 3,285
87 votes
17 answers
136k views

UIImageView - How to get the file name of the image assigned?

Is it possible to read the name of an UIImageView's UIImage that's presently stored in the UIImageView? I was hoping you could do something kind of like this, but haven't figured it out. NSString *...
Kuberchaun's user avatar
  • 29.7k
82 votes
14 answers
147k views

Add animated Gif image in Iphone UIImageView

I need to load an animated Gif image from a URL in UIImageview. When I used the normal code, the image didn't load. Is there any other way to load animated Gif images?
Velmurugan's user avatar
  • 2,303
82 votes
14 answers
67k views

Circular UIImageView in UITableView without performance hit?

I have a UIImageView on each of my UITableView cells, that display a remote image (using SDWebImage). I've done some QuartzCore layer styling to the image view, as such: UIImageView *itemImageView = (...
swiftcode's user avatar
  • 3,049
79 votes
10 answers
173k views

How to set corner radius of imageView?

In Objective-C such line self.mainImageView.layer.cornerRadius = CGRectGetWidth(self.mainImageView.frame)/4.0f; does its job, I tried it in Swift using analogy self.mainImageView.layer.cornerRadius ...
theDC's user avatar
  • 6,464
78 votes
15 answers
85k views

How to write text on image in Objective-C (iOS)?

I want to make an image like this programmatically: I have the upper image and text with me. Should I write text on the image? I want to make it a complete .png image(image + label) and set it as ...
Sanchit Paurush's user avatar
76 votes
5 answers
71k views

What is the best way to create a shadow behind a UIImageView

I have a UIImageView that I want to add a shadow behind. I wish that apple had that as a property but they have to make lots of things hard for us programmers so I need to ask this question.
Jab's user avatar
  • 27.3k
76 votes
23 answers
54k views

"Creating an image format with an unknown type is an error" with UIImagePickerController

While choosing an image from the image picker in iOS 10 Swift 3 I am getting an error - Creating an image format with an unknown type is an error func imagePickerController(picker: ...
Jeet's user avatar
  • 5,629
74 votes
20 answers
44k views

How to know the image size after applying aspect fit for the image in an UIImageView

I am loading an image to an imageview with mode as 'Aspect Fit'. I need to know the size to which my image is being scaled to. Please help.
Nithin's user avatar
  • 6,445
74 votes
5 answers
78k views

Passing through touches to UIViews underneath

I have a UIView with 4 buttons on it and another UIView on top of the buttons view. The top most view contains a UIImageView with a UITapGestureRecognizer on it. The behavoir I am trying to create ...
Magic Bullet Dave's user avatar
72 votes
8 answers
78k views

With Auto Layout, how do I make a UIImageView's size dynamic depending on the image?

I want my UIImageView to grow or shrink depending on the size of what the actual image it's displaying is. But I want it to stay vertically centered and 10pts from the leading edge of the superview. ...
Doug Smith's user avatar
  • 29.9k
71 votes
10 answers
77k views

How to stop an image from stretching within a UIImageView?

I have a UIImageView where I have set the frame size to x = 0, y = 0, width = 404, height = 712. In my project, I need to change the image in UIImageView dynamically. I am using this code to change ...
R. Dewi's user avatar
  • 4,161
69 votes
10 answers
113k views

How do I make an UIImage/-View with rounded corners CGRect (Swift)

How do I make a UIImageView with rounded corners on a Swift iOS Playground? Inside it needs to be filled with a color.
Thomas's user avatar
  • 1,468
66 votes
7 answers
67k views

How to make a circular UIView

I want to make a UIView or UIImageView that is a circle. Or a circle that i can change the size of using a slider, and the color of with a pickerview.
Jab's user avatar
  • 27.3k
66 votes
7 answers
47k views

Tiled Background Image: Can I do that easily with UIImageView?

I have a fullscreen background image that is tiled, i.e. it has to be reproduced a few times horizontally and vertically in order to make a big one. Like in the browsers on ugly home pages ;) Is ...
Thanks's user avatar
  • 40.3k
66 votes
5 answers
78k views

Removing image from UIImageView

I load a UIImageView with an image depending on user interaction. When the parent view is initially displayed, no image has been selected and the imageview is black. If the user leaves that view and ...
4thSpace's user avatar
  • 44.1k
64 votes
8 answers
78k views

Insets to UIImageView?

I would like to achieve : Scale to fill mode of image view Insets to UIImageView so that image does not meet the edges of the UIImageView Bottomline: I want to increase the touch area of the ...
Sarasranglt's user avatar
  • 3,839
63 votes
8 answers
50k views

UIImage aspect fit and align to top

It looks like aspect fit aligns the image to the bottom of the frame by default. Is there a way to override the alignment while keeping aspect fit intact? ** EDIT ** This question predates auto ...
Jacksonkr's user avatar
  • 31.9k
60 votes
13 answers
28k views

UIImageView doesn't always tint template image

In the case below, there are two UIImageViews with the same settings and the same template image... But one tints the image, and one does not I duplicated working UIImageView and placed it instead of ...
Zuzana Paulis's user avatar
60 votes
24 answers
115k views

How to set imageView in circle like imageContacts in Swift correctly?

I want to show a picture into imageView like the image contact (in a circle) But when I try to show this, the imageView rescale his size and this doesn't show correctly in a circle. image.layer....
user3745888's user avatar
  • 6,193
57 votes
4 answers
34k views

Apple Interface Builder: adding subview to UIImageView

I created UIImageView with the help of Interface Bulder. Now I want to place label inside it (as its subview). In code I can type something like: [myUIImageView addSubview:myUILabel]; But can I do it ...
kpower's user avatar
  • 3,891
56 votes
7 answers
63k views

add UIImage in CALayer

I must add a UIImageView as subview of MapView. To do this I created a layer above the MapView. In this layer I want to put my image, but I get a white rectangle and nothing else. My image is not ...
Ortensia C.'s user avatar
  • 4,706
55 votes
9 answers
91k views

iOS: load an image from url

I need to load an image from a url and set it inside an UIImageView; the problem is that I don't know the exact size of the image, then how can I show the image correctly?
cyclingIsBetter's user avatar
54 votes
11 answers
48k views

UITableViewCell with image on the right?

Is there a way to set the UITableViewCell.image to display on the right hand side of the cell instead of the left? Or will I need to add a separate UIImageView on the right side of the cell layout?
Oliver GL's user avatar
  • 553
53 votes
4 answers
52k views

How to get the frame of a view inside another view?

I have an UIImageView in the self.view (the main View) and inside it there is a UIButton. I want to know what's the frame of UIButton in self.view not in UIImageView.
cyclingIsBetter's user avatar

1
2 3 4 5
213