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
1 answer

How to load an image with unique names from a private folder?

I am working on an app for iPad where I want to have lets say 100 jpg's in a folder. They could be named like 01.jpg, 02.jpg etc. In my app I like to browse those images and when clicking on one of them I need the name of the image to be able to…
Wiljan
  • 31
  • 3
2
votes
1 answer

Change popup size of UIImage in ContextMenu?

Say you have a context menu for an image that pops up when long pressed. How can you make the popup larger, but keep the same dimension? ViewControllerTableViewCell: UITableViewCell, UIContextMenuInteractionDelegate { func contextMenuInteraction(_…
2
votes
2 answers

Animation doesn't start without view update

Sample on GitHub I have a strange problem. I have Navigation-based app with two UIViewControllers and Curl effect for transition between these. I add to bar button and add custom action: -(IBAction)pushPage { NSLog(@"push page"); …
Sound Blaster
  • 4,778
  • 1
  • 24
  • 32
2
votes
1 answer

Maintain zoom scale when image is rotated inside UIScrollView

I have an image inside a ScrollView. It allows for pinch and zoom. It is also possible to rotate the image inside the ScrollView to a custom degree. When I do that, I lose the current zoom level of the image, and it reverts back to its 100% zoom and…
user542584
  • 2,651
  • 2
  • 25
  • 29
2
votes
1 answer

Proper release of UIImagePickerController

I'm a bit confused with this as I've seen way too many different variants and not sure which one is the correct way. Currently I have: - (IBAction)pickImageFromLibrary:(id)sender { UIImagePickerController *picker = [[UIImagePickerController…
Ernő Simonyi
  • 355
  • 3
  • 20
2
votes
1 answer

Scroll and zoom to specific CGRect of UIImageView

I have a UIScrollView and a UIImageView inside. The UIScrollView size is 350x350 and the image inside the UIImageView is 350x350. The UIScrollView has a zoomScale of 4. I want to show only the specific point of the image rect: CGRect(x: 100, y: 100,…
ytpm
  • 4,962
  • 6
  • 56
  • 113
2
votes
1 answer

UIView display order issue?

The problem When drawing a custom movie player controller on-screen (iOS 4), I use an AVPlayerLayer to display. I wish to composite some overlays on top of the player (ad banners, player controls, etc). At the moment, this works absolutely fine with…
user244343
2
votes
3 answers

Incorrect size of Images in TableView

I am creating a table view with images from an URL, but the images don´t re-size to all the view until I presset it in the row. any idea why that is happening? This is a custom tableview My code is : - (UITableViewCell *)tableView:(UITableView…
DaSilva
  • 1,358
  • 1
  • 19
  • 42
2
votes
1 answer

Calling drawInRect on an UIImageView's image: which rect to use?

I'm trying to write a finger paint type program using Quartz graphics. The problem I'm having is when the screen rotates. The dots and lines I draw "creep" away from where I'm touching. With each successive touch, the previous dot creeps away. …
2
votes
2 answers

rounded corner in UIImageView

I have the following code: [avatar.layer setBorderColor:[[UIColor whiteColor] CGColor]]; [avatar.layer setBorderWidth:2.0]; [avatar.layer setShadowOffset:CGSizeMake(-1.0, -1.0)]; [avatar.layer setCornerRadius:8]; It does give me a rounded white…
adit
  • 32,574
  • 72
  • 229
  • 373
2
votes
3 answers

border in UIImageView

I am trying to have an UIImageView bordered like the following: I have tried using: [imageView.layer setBorderColor: [[UIColor whiteColor] CGColor]]; [imageView.layer setBorderWidth: 2.0]; but then you can't see that gray border on the outside. It…
aherlambang
  • 14,290
  • 50
  • 150
  • 253
2
votes
2 answers

UIImage content mode aspectFit and bottom

Is it possible to set the contentMode for my UIImage to .scaleAspectFit and .bottom simultaneously ? This is how my image looks like at the moment: UIImageView: let nightSky: UIImageView = { let v = UIImageView() v.image = UIImage(named:…
Chris
  • 1,828
  • 6
  • 40
  • 108
2
votes
1 answer

UIImageView contentMode scale aspect fill is stretching the image

I set my UIImageView.contentMode = UIViewContentModeScaleAspectFill, but it is still stretching the image. (Not a clipping issue, it is stretching the image.) It even shows it stretched in my Storyboard. I created an image of green and brown squares…
Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229
2
votes
3 answers

ImageView becomes blank on Screen orientation change

I am using the below line to set my ImageView. Bitmap bm = Media.getBitmap(getContentResolver(), capturedImage); Bitmap bm1=Bitmap.createScaledBitmap(bm, 300, 300,true); pic.setImageBitmap(bm1); But when…
Andro Selva
  • 53,910
  • 52
  • 193
  • 240
2
votes
3 answers

Memory consumption while loading a large image in uiimageview in

I am loading a UIImage of size 2480 × 3508 into UIImageView using UIViewContentModeScaleAspectFit. I am getting memory warning while loading this image. And after i loaded a few images of this size in this UIImageView the application crashes. Is…
Priyanka V
  • 834
  • 2
  • 12
  • 34