uiimageview

UIImageView+animatedGIF always LOOPS

旧时模样 提交于 2019-12-21 01:22:51
问题 I used class made by "mayoff" (Rob Mayoff) "UIImageView+animatedGIF" which was proposed in one of the answers here on stackoverflow. UIImageView+animatedGIF With it I can import animated .gif images in UIImageView on iOS. This class works flawlessly, but the only problem is that .gif is always looping. No matter how I export it (I am exporting image from photoshop - 67 frames, set repeat to "once") it loops forever in UIImageView. I am importing my .gif with these two lines: NSURL *url = [

Swift UIImageView Stretched Aspect

有些话、适合烂在心里 提交于 2019-12-20 16:50:32
问题 UIImageView renders the size of an image incorrectly. Using Scale Aspect Fit, if the UIImageView is a square the image is the correct aspect ratio with transparency in the areas the image does not fill. //Image is Square & Correct Size var imageView = UIImageView(frame: CGRectMake(0, 50, 320, 320)) imageView.clipsToBounds = true imageView.contentMode = UIViewContentMode.ScaleAspectFit //Image is Rectangle & Incorrect Size var imageView = UIImageView(frame: CGRectMake(0, 50, 320, 450))

Swift UIImageView Stretched Aspect

∥☆過路亽.° 提交于 2019-12-20 16:50:20
问题 UIImageView renders the size of an image incorrectly. Using Scale Aspect Fit, if the UIImageView is a square the image is the correct aspect ratio with transparency in the areas the image does not fill. //Image is Square & Correct Size var imageView = UIImageView(frame: CGRectMake(0, 50, 320, 320)) imageView.clipsToBounds = true imageView.contentMode = UIViewContentMode.ScaleAspectFit //Image is Rectangle & Incorrect Size var imageView = UIImageView(frame: CGRectMake(0, 50, 320, 450))

Rotate image in UIImageView

偶尔善良 提交于 2019-12-20 14:12:13
问题 Is it possible to rotate only image in UIImageView? I'm looking for information about it, but i only found information how rotate UIImageVeiw. 回答1: You can rotate the image with the following code. Note, this uses a CGImageRef which you can get from a UIImage via CGImageRef imageRef = [self CGImageRotatedByAngle:[image CGImage] angle:30]; Once you get the rotated image, you can set the ImageView's image to your new rotated image like this: UIImage* img = [UIImage imageWithCGImage: imageRef];

How do I get a thumbnail or saveable path from UIImagePickerController to use for a UIImageView?

℡╲_俬逩灬. 提交于 2019-12-20 10:11:48
问题 Could somebody please explain or show some sample code of how I can use get a thumbnail to be put into a UIImageView after the user selects a photo with UIImagePickerController? Let's say I want to set a thumbnail as the image of a table view cell. When the user presses the cell, the image picker is shown and the user selects an image that is already on their device. I also want to save the path to that thumbnail so that the next time the view is displayed, the proper thumbnail can be shown.

What is the most efficient way to add a reflection to a UIImageView

守給你的承諾、 提交于 2019-12-20 09:56:11
问题 I just want the easiest way to make a reflection under a UIImageVies that is easily managable. 回答1: As Phil says, you can have a "reflected" UIImageView instance: @interface ReflectedImageView : UIView { @private UIImageView *_imageView; UIImageView *_imageReflectionView; } @property (nonatomic, retain) UIImage *image; @end And then, in your implementation, something like this @implementation ReflectedImageView @dynamic image; - (id)initWithFrame:(CGRect)frame { if (self = [super

Handling download of image using SDWebImage while reusing UITableViewCell

喜欢而已 提交于 2019-12-20 09:45:45
问题 I have used third party library SDWebImage to download image for my UITableView cells, UIImageView is created within cell and fired request while configuring cell like this. [imageView setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:[UIImage imageNamed:@"default.jpg"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) { }]; Its working fine, however when I scroll fast, most of the images are not fully downloaded (I can see that in charles) because of that

Difference between UIImage and UIImageView

雨燕双飞 提交于 2019-12-20 08:56:59
问题 What is the difference between UIImage and UIImageView ? Can someone explain it with an example? 回答1: Example: UIImage *bgImage = [UIImage imageNamed:@"Default@2x.png"]; UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:bgImage]; backgroundImageView.frame = [[UIScreen mainScreen] bounds]; UIImage Overview: A UIImage object is a high-level way to display image data. You can create images from files, from Quartz image objects, or from raw image data you receive. The UIImage

Using cornerRadius on a UIImageView in a UITableViewCell

无人久伴 提交于 2019-12-20 08:53:51
问题 I'm using a UIImageView for each of my UITableViewCells , as thumbnails. My code uses SDWebImage to asynchronously grab those images from my backend and load them in, and then caching them. This is working fine. My UIImageView is a 50x50 square, created in Interface Builder. Its background is opaque, white color (same as my UITableViewCell background color, for performance). However, I'd like to use smooth corners for better aesthetics. If I do this: UIImageView *itemImageView = (UIImageView

Erasing on UIImageView

落爺英雄遲暮 提交于 2019-12-20 08:52:45
问题 How can I erase content on front UIImage by swiping finger on it and display UIImage that is back side of UIView. I had used following code in - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event to erase front image: -(void)eraseDrawingContents { UIGraphicsBeginImageContext(frontImage.frame.size); [frontImage.image drawInRect:CGRectMake(0, 0, frontImage.frame.size.width, frontImage.frame.size.height)]; CGContextSaveGState(UIGraphicsGetCurrentContext());