uiimageview

Scaling UIImageView to fit width with AutoLayout

本小妞迷上赌 提交于 2019-12-07 13:23:56
问题 I have a UIImageView on top of a UIScrollView, and I would like it to fit the device width, its height then being automatically set so that the image ratio is preserved. I am using Auto Layout, so I used constraints to bind the UIImageView to the top, left and right edges of the screen. My problem is, the UIImageView automatically resizes its frame to fit the UIImage height. And I cannot really change this frame afterwards, as it lets a gap between the UIImageView and the other UI elements,

iOS UIImage being rotated when after going through CIFilter

こ雲淡風輕ζ 提交于 2019-12-07 12:13:02
问题 I'm working with filtering images that I'm taking with the camera. I pass the image I get from the camera through the below method. Which I have the returned UIImage sent to a UIImageView . For some reason when it passes through this method the image is getting rotated. What am I doing wrong? - (UIImage *) applyFilterToImage:(UIImage *)image withFilter:(NSString *)filterName { beginImage = [[[CIImage alloc] initWithImage:image] autorelease]; context = [CIContext contextWithOptions:nil];

UIImageView响应点击事件

こ雲淡風輕ζ 提交于 2019-12-07 10:20:22
C代码 UIImageView *imageView = [self getYourImageView]; imageView.image = [self getYourImage]; imageView.userInteractionEnabled = YES; UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(yourHandlingCode:)]; [imageView addGestureRecognizer:singleTap]; [singleTap release]; UITapGestureRecognizer 的用法 Java代码 //单指单击 UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self action: @selector (handleSingleFingerEvent:)]; singleFingerOne.numberOfTouchesRequired = 1 ; //手指数 singleFingerOne.numberOfTapsRequired = 1 ;

How To Enlarge UIImageView When Tapped

纵然是瞬间 提交于 2019-12-07 09:10:19
问题 I'm very new to programming, so I'm having some issues trying to do this. I have an app that displays an image in a UIImageView, and I would like for the image to enlarge when the user taps on it. I figured that the easiest way to do this would be to hide a translucent button over the UIImageView, and fire off an action when the user taps it. That is about as far as I can get, I have no idea what my action method should look like. This is what I have so far: - (IBAction)enlargeImage1:(id

Objective C: Programmatically create a UIImageView

天涯浪子 提交于 2019-12-07 08:46:05
问题 I'm trying to make a UIImageView with a .png load up in the location of a button when it is clicked. brickAnim = UIImageView.alloc; ///////freezes during runtime [brickAnim initWithFrame:currentBrick.frame]; [brickAnim setImage:[NSString stringWithFormat:@"brick-1.png"]]; [self.view addSubview:brickAnim]; current brick is the name of the button that's being clicked. I've narrowed it down and figured out that the first line causes the app to freeze and exit. I can't figure out what I'm doing

How to set imageView image on prepareForSegue iOS?

我只是一个虾纸丫 提交于 2019-12-07 08:24:25
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.isBackImage = true; } } } I have an ImageView in HomeViewController . I tried to set it's image using

color selected part of image on touch

╄→гoц情女王★ 提交于 2019-12-07 07:50:28
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 one portion, and color will be filled automatically , but will not have to drag the finger to color the

skewing a UIImageView using CGAffineTransform

你。 提交于 2019-12-07 07:16:38
问题 I am trying to skew a rectangle so the two vertical sides are slanted but parallel and the top and bottom are horizontal. I am trying to use CGAffineTransform and have found this code but I am not figuring out what to put in the various parts. imageView.layer.somethingMagic.imageRightTop = (CGPoint){ 230, 30 }; imageView.layer.somethingMagic.imageRightBottom = (CGPoint){ 300, 150 }; #define CGAffineTransformDistort(t, x, y) (CGAffineTransformConcat(t, CGAffineTransformMake(1, y, x, 1, 0, 0)))

How to get image url from html string using regex

三世轮回 提交于 2019-12-07 06:04:48
问题 I am trying to get from html string using regex which I am currently working on was this : extension String { func regex (pattern: String) -> [String] { do { let regex = try NSRegularExpression(pattern: pattern, options: NSRegularExpressionOptions(rawValue: 0)) let nsstr = self as NSString let all = NSRange(location: 0, length: nsstr.length) var matches : [String] = [String]() regex.enumerateMatchesInString(self, options: NSMatchingOptions(rawValue: 0), range: all) { (result :

Setting the image of a UIImageView in Interface Builder

痞子三分冷 提交于 2019-12-07 06:02:50
问题 When ever I set an image for a UIImageView in IB and simulate the interface the buttons and stuff show up but the image view doesn't. 回答1: That's because the simulator used by Interface Builder is independent of your project. It's just taking your xib files, building the interface, and displaying it. As such, any resources it finds references to but can't find will be skipped. So if your UIImageView uses an image named "myImage.png", then when the simulator runs, it's going to try to execute