uiimageview

UIImage from camera is rotated 90 degrees - using extensions

被刻印的时光 ゝ 提交于 2020-01-05 03:47:11
问题 When Image data is returned and applied to a UIImage, if the data comes from the camera then the image appears rotated 90 degrees. I tried adding the extension UIImage { func correctlyOrientedImage() -> UIImage { if self.imageOrientation == UIImageOrientation.up { return self } UIGraphicsBeginImageContextWithOptions(self.size, false, self.scale) self.draw(in: CGRect(origin: CGPoint(x: 0,y :0), size: CGSize(width: self.size.width, height: self.size.height)) ) let normalizedImage:UIImage =

Why moving UIView is not moving UIImageView on same view?

心已入冬 提交于 2020-01-05 03:33:45
问题 I have an ImageView on a UIView. I'm trying to move view keyboard size but all content move properly instead of UIImageView. -(void) keyboardWillShow:(NSNotification *) notification { NSDictionary* keyboardInfo = [notification userInfo]; // Work out where the keyboard will be NSValue* keyboardFrameBegin = [keyboardInfo valueForKey:UIKeyboardFrameBeginUserInfoKey]; CGRect keyboardFrameBeginRect = [keyboardFrameBegin CGRectValue]; // Work out animation duration NSTimeInterval animationDuration

Any example iPhone code for an Analog Clock?

五迷三道 提交于 2020-01-05 02:50:09
问题 Interested in creating by own analog clock application - anyone know of some example project/code that implements an analogue clock? (i.e. not a digital clock). Ideally with a custom background, and custom hour/minute hands as images? I note that the following link exists, however was hoping for something just a little more specific to matching what I'm doing (background image, images for the hour/minute hands): Example Code 回答1: Create a background image, and images for each of the hands

UIImageView.appearance is overriding UISegmentedControl.appearance

♀尐吖头ヾ 提交于 2020-01-05 01:08:11
问题 I've been trying to use the appearance proxy API to apply some default colors to some controls, but I've run into a problem. When I apply a tint color to UISegmentedControl using something like... UISegmentedControl.appearance().tintColor = UIColor.red It generates this... All good, but when I add... UIImageView.appearance().tintColor = UIColor.green it changes to... Just to be clear, I have BOTH this lines in my code UISegmentedControl.appearance().tintColor = UIColor.red UIImageView

How to scale UIImageView properly with UIView animateWithDuration?

◇◆丶佛笑我妖孽 提交于 2020-01-04 11:12:26
问题 I'm scaling UIImageView and then reverting it using UIView animateWithDuration with UIViewAnimationOptionAutoreverse option. The problem is the image animation is a little bit jaggy (twitching) at the end of the animation. Here's my code: [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionAutoreverse animations:^{ myImage.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);} completion:^(BOOL finished){if (finished){ myImage.transform =

How to scale UIImageView properly with UIView animateWithDuration?

↘锁芯ラ 提交于 2020-01-04 11:12:14
问题 I'm scaling UIImageView and then reverting it using UIView animateWithDuration with UIViewAnimationOptionAutoreverse option. The problem is the image animation is a little bit jaggy (twitching) at the end of the animation. Here's my code: [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionAutoreverse animations:^{ myImage.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);} completion:^(BOOL finished){if (finished){ myImage.transform =

How to scale UIImageView properly with UIView animateWithDuration?

我们两清 提交于 2020-01-04 11:12:02
问题 I'm scaling UIImageView and then reverting it using UIView animateWithDuration with UIViewAnimationOptionAutoreverse option. The problem is the image animation is a little bit jaggy (twitching) at the end of the animation. Here's my code: [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionAutoreverse animations:^{ myImage.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);} completion:^(BOOL finished){if (finished){ myImage.transform =

Making round corners for a UIImage

↘锁芯ラ 提交于 2020-01-04 06:53:25
问题 In my iPhone application I have to show a UIImage with its all four corners curved so that it looks good on the screen. But my image is a rectangular image which cannot be altered at image level as it comes from a third party. With UIImageView I can set the frame. Using code, how can I modify my UIImage to have rounded corners? Any clue? 回答1: try this way: UIImageView *imageView = ...; imageView.layer.cornerRadius = 7; // change this value as per your desire imageView.clipsToBounds = YES; 来源:

How to detect when the non-transparent part of an UIImage is in contact with another non-transparent part of an UIImage

自闭症网瘾萝莉.ら 提交于 2020-01-04 04:41:06
问题 I am having trouble accomplishing something that I thought was going to be much easier. I am trying to run a method whenever a non transparent part of a picture inside a UIImage touches another non-transparent part of an image contained within a UIImage. I have included an example to help further explain my question. As you can see in the image above, I have two triangles that are both inside a UIImage. The triangles are both PNG pictures. Only the triangle is visible because the background

How to save a uiimageview on top of another uiimageview (swift3)

跟風遠走 提交于 2020-01-04 04:19:29
问题 Right Now I have two image views. All the button does is save the photo with the red box over the blue box and it will save image2 in the blue box and image1 in the red box. I would like red box to be saved over the blue box in just the small bottom right section of the blue box. Just like a lower third you see on tv ]] import UIKit class ViewController: UIViewController { var image1 = UIImage(named: "f.jpg") var image2 = UIImage(named: "l.jpg") override func viewDidLoad() { super.viewDidLoad