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
118
votes
2 answers

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 built in support for iPad and retina images, you…
Rog
  • 17,070
  • 9
  • 50
  • 73
117
votes
6 answers

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 have retrieved and placed the image in the…
forgot
  • 2,160
  • 2
  • 19
  • 20
112
votes
17 answers

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 of the images varies. Also I would like small…
Robert
  • 37,670
  • 37
  • 171
  • 213
103
votes
8 answers

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(20, 60, 10, 30); [self.view…
Sumit Patel
  • 2,547
  • 8
  • 33
  • 45
98
votes
10 answers

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
  • 5,051
  • 11
  • 43
  • 47
95
votes
9 answers

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?, data: NSData, text: NSString?) -> () in let…
Marius
  • 964
  • 1
  • 7
  • 9
94
votes
4 answers

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: Scaling up and then down of each image, one after…
raistlin
  • 4,298
  • 5
  • 32
  • 46
90
votes
16 answers

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! override func viewDidLoad() { …
Pixel
  • 1,946
  • 2
  • 15
  • 26
88
votes
9 answers

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 opacities. Thoughts?
Marty
  • 5,926
  • 9
  • 53
  • 91
88
votes
13 answers

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 little then just bounces back. Thank you. here is…
RandomBytes
  • 1,781
  • 1
  • 13
  • 14
87
votes
17 answers

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 *currentImageName = [MyIImageView getFileName];
Kuberchaun
  • 29,160
  • 7
  • 51
  • 59
86
votes
14 answers

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 show it in proper orientation, as it was…
Martin Pilch
  • 3,245
  • 3
  • 38
  • 61
82
votes
13 answers

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
  • 2,303
  • 6
  • 30
  • 45
82
votes
14 answers

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 = (UIImageView *)[cell viewWithTag:100]; …
swiftcode
  • 3,039
  • 9
  • 39
  • 64
78
votes
15 answers

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 the background of the button.
Sanchit Paurush
  • 6,114
  • 17
  • 68
  • 107