uiimageview

How to set imageView image on prepareForSegue iOS?

落爺英雄遲暮 提交于 2019-12-08 05:17:10
问题 I tried to push to a ViewController using prepareForSegue . When I'm pushing, I want to set an image on ImageView in pushed view controller. Here what I tried, ViewController -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ UIButton *btn = sender; if (btn.tag == 50) { if (jpegData) { [self saveTempImage:jpegData]; } if ([segue.identifier isEqualToString:@"HomeView"]) { HomeViewController *vc = [segue destinationViewController]; vc.backImageView.image = capturedImage; vc

How to crop an image with a selectable area in swift 4 or later?

你说的曾经没有我的故事 提交于 2019-12-08 04:57:17
问题 I need some help with a function that I'd like to implement in my app. I have a view with an image view with content mode in Aspect Fit. When I get an image from my library I would like to crop an area with an adjustable rectangle creating a new image. I've looked for some exemple or online tutorial but I did not succeed. Can anyone help me with that? Here are the images from my View. . 回答1: The simple solution is to just render the image view within a particular CGRect : func snapshot(in

What might cause a partially loaded JPEG in a UIImageView?

為{幸葍}努か 提交于 2019-12-08 04:44:50
问题 We are getting reports in the field, on both iOS and Android, of partially loaded profile images in our mobile app. Here is what it looks like (note that I have gaussian blurred part of the image to protect the privacy of our members, but the grey is what is actually rendered): AFAIK there is not a concept of loading "Progressive JPEGS" in UIImageView, so I am at a loss about how this image could even have been rendered at all. This code has not been modified in at least a year. All images

IOS: How to split an UIImage into parts

青春壹個敷衍的年華 提交于 2019-12-08 04:13:53
问题 In one of my application I need to split UIImage into multiple parts. The following was the code I am using to split. Here my problem is I am unable to load the image view by adding the image to UIImageView. - (void)viewDidLoad { UIImage* image = [UIImage imageNamed:@"monalisa.png"]; NSMutableArray* splitImages = [self splitImageIntoRects:(__bridge CGImageRef)(image)]; printf("\n count; %d",[splitImages count]); CALayer *layer = [splitImages objectAtIndex:5]; CGImageRef imgRef = (__bridge

color selected part of image on touch

冷暖自知 提交于 2019-12-08 04:07:21
问题 I am trying to color the image when user will touch the image. I am using following code to color image, but in that I am able to fecth the RGB of the touch portion but not able to change the color. Also I don't want to color whole image , see the image ,in that all the parts as having black border ,and once user will click on the particular part that color will be changed as per the color selected by user. Please guide me how to change color for the selected part - also user will only touch

Combining images

≯℡__Kan透↙ 提交于 2019-12-08 04:07:07
问题 I want to place the picked image on top of another image, so that my picked image will be placed in some sort of frame I made in Photoshop. After combining the images I want to save it to the disk. Does anyone know how to do it, or maybe have a link to examples? 回答1: You can just layer the two images on top of each other, first add the frame image, then add the image with the photo... Heres sample code Assuming your 2 images are already sized correctly to fit one on top of t he other, this

Autolayout (with Masonry) with corner radius

人盡茶涼 提交于 2019-12-08 03:58:09
问题 I would like to layout a circular UIImageView with Masonry. So I have created the UIImageView like this: [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.mas_centerX); make.top.equalTo(self.mas_top).with.offset([[UIView ub_padding] floatValue]); make.bottom.equalTo(self.descriptionLabel.mas_top).with.offset(-[[UIView ub_padding] floatValue]); make.height.equalTo(self.descriptionLabel.mas_height).priorityHigh(); make.width.equalTo(self.imageView.mas

How can I increase/decrease the brightness of UIImage and I need to save the resultant image?

久未见 提交于 2019-12-08 03:34:46
问题 I've an image , I want to change its brightness and I need to save the resultant image obtained from the actual image, how can I do it. I want to increase the brightness using a UIslider? 回答1: Get the code from the Github for UIImage category here. To brighten the image, write the code as below: //brighten value can be obtained from slider change event from -255 to 255. UIImage* brightImage = [originalImage brightenWithValue:sliderValue]; //Convert image into data NSData *brightImageData =

Drawing a rectangle on UIImageView using Core Graphics

大兔子大兔子 提交于 2019-12-08 03:31:25
问题 I want to let the User to draw a rectangle on UIImageView I added two variables for first an last touch locations I added this function:- func draw(from: CGPoint, to: CGPoint) { UIGraphicsBeginImageContext(imageView.frame.size) context = UIGraphicsGetCurrentContext() context?.setStrokeColor(UIColor(red: 0, green: 0, blue: 0, alpha: 1.0).cgColor) context?.setLineWidth(5.0) let currentRect = CGRect(x: from.x, y: from.y, width: to.x - from.x, height: to.y - from.y) context?.addRect(currentRect)

IPhone UIImagepicker with camera showing camera roll thumbnail like default camera app?

那年仲夏 提交于 2019-12-08 03:29:37
问题 im working in iphone's camera app, using UIImagePicker to launch the camera. Everything goes well, just a need to use the default controls showed in the camera app in iphone(little thumbnail from the last pic in camera roll and take photo buttons) and its animation(take and send the picture to the left bottom thumbnail), not default in UIImagePicker (cancel and take photo buttons). How i can do that? thankz :D 回答1: You can't do that. What you should do is present a UIActionSheet and ask if