uiimageview

iPad app crashed due to memory warning while combining/merging two images

自古美人都是妖i 提交于 2019-12-10 11:50:18
问题 My app is crashing due to heavy use of memory while I am doing image processing. Basically my whole app depends on following method in which logic for combining images are used another method i used for loading images from bundle. + (UIImage*)imageByCombiningImages:(UIImage*)firstImage withImage:(UIImage*)secondImage { @autoreleasepool { UIImage *image = nil; CGSize newImageSize = CGSizeMake(MAX(firstImage.size.width, secondImage.size.width), MAX(firstImage.size.height, secondImage.size

Resizing UIImageView inside a UITableViewCell

流过昼夜 提交于 2019-12-10 11:43:40
问题 in my app the UITableViewCell size are dynamic which means each has it's own height. inside of each cell there is a background image in a UIImageView . Through storyboard, i used autolayouts to customize the UIImageView to automatically stretch as the cell is stretched. The problem is that when they stretch the whole image stretches with the corners. So i was looking up online and i came over using resizableImageWithCapInsets: in order to stretch the stretchable sides and exclude the unwanted

iOS: Image view aspect fit with corner radius

此生再无相见时 提交于 2019-12-10 11:30:00
问题 I want to set corner radius with content mode as aspect fit using following code: cell.imgvAlbum.contentMode = UIViewContentModeScaleAspectFit; cell.imgvAlbum.clipsToBounds = YES; cell.imgvAlbum.layer.cornerRadius = 5.0f; but i am getting output only for content mode as aspect fit. I have also tried for: cell.imgvAlbum.layer.masksToBounds = YES; What to do for corner radius? Please suggest me some solution. Thanks in advance. 回答1: Use below method to get a Rounded corner image with the

iPhone - Center UIImage in UIImageView

守給你的承諾、 提交于 2019-12-10 11:15:35
问题 I have a UIImageView. I get a UIImage from a URL. The image displays in the UIImageView, but I can't get it to center correctly. The UIImage is 80 x 68 pixels. The UIImaveView's size is 90 x 90. When I display the UIImage in the UIImageView the UIImage is shrunken so that it fits, although it is already smaller than the UIImageView. I have tried all the Content Modes in IB. Some of them shift the image up so that it is no longer in the UIImageView. None of this really makes sense to me. It

Fitting a UIImage in UIImageView

谁说胖子不能爱 提交于 2019-12-10 11:09:33
问题 I need to resize my UIImage according to the size of UIImageView . My image is too small, so i need to scale it up. I was not able to do it using: self.firstImage.contentMode = UIViewContentModeScaleAspectFit; Please help. 回答1: You just need to set the frame of your UIImageView and set the contentMode to one of the resizing options. Or you can use this utility method, if you actually need to resize an image: + (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize { /

Animating UIImageView with colorWithPatternImage

时光毁灭记忆、已成空白 提交于 2019-12-10 10:59:54
问题 I have a UIImageView that is animated using the following code: NSMutableArray *imageArray = [[NSMutableArray alloc] init]; for(int i = 1; i < 15; i++) { NSString *str = [NSString stringWithFormat:@"marker_%i.png", i]; UIImage *img = [UIImage imageNamed:str]; if(img != nil) { [imageArray addObject:img]; } } _imageContainer.animationImages = imageArray; _imageContainer.animationDuration = 0.5f; [_imageContainer startAnimating]; What I want now is to repeat the image to get a pattern. There is

How to compare two UIImage in iOS 8 [duplicate]

女生的网名这么多〃 提交于 2019-12-10 10:58:32
问题 This question already has answers here : UITableViewCell.ImageView.image Compare UIImage (3 answers) Closed 5 years ago . I am using the method given below IBOutlet UIImageView *imgViewCheck; - (IBAction)clkCheckUncheck:(id)sender { if (imgViewCheck.image == [UIImage imageNamed:@"uncheck.png"]) { imgViewCheck.image = [UIImage imageNamed:@"check.png"]; } else { imgViewCheck.image = [UIImage imageNamed:@"uncheck.png"]; } } It is working in up to iOS7 but not working in iOS8 回答1: Please compare

UIImageView pinch zooming in UIScrollView

纵然是瞬间 提交于 2019-12-10 10:57:24
问题 I am comfortable with pinch zooming functionality using UIScrollView. But the problem is the aspect fit of image in scrollview. Currently, I am having this, below image: But I want image to be fit in screen like below image: And same behavior for landscape. How can I achieve this? Below is the code: - (void)viewDidLoad { UIImage *image = [UIImage imageWithData:appDelegate.selectedOriginalImage]; imgView.image = image; CGSize imageSize = image.size; CGRect rect = CGRectMake(0, 0, imageSize

add subLayer to a imageView.layer

梦想与她 提交于 2019-12-10 10:39:54
问题 well I know that every imageViews have a layer (we can access it with :imageView.layer).I would like to use the layer of my imageView and add a subLayer to it's layer: shapeLayer (that is a CAShapeLayer) My code doesn't work, it doesn't show the shape layer! - (void)viewDidLoad { imageView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)]; [self.view addSubview:imageView]; } - (void)anotherMethod { [imageView.layer addSublayer:shapeLayer]; } How can I solve this please ?

AutoLayout - Keep Ratio of Image With Horizontal Constraints (Swift Xcode 6)

邮差的信 提交于 2019-12-10 10:36:37
问题 I've been trying to implement a timeline of picture (as instagram or facebook). However, I've been struggling with the ratio of the image. Here's my xib that contains my Cell : I want the picture to keep its ratio and to completely fill the width of the cell. I've set 4 autolayout constraint on the UIImageView as 0-0 for horizontal constraint and 5-5 for top/bottom constraints. I've also set the ViewMode to "Aspect Fit". I've tried different setup : set the height of UIImageView to a specific