ios - UIImage distorted when using it for UIImageView -
I have taken a picture, and then I am starting a UIImageView object with this picture. The only problem is that when I take a picture, the picture is being taken using the full screen of the iPhone.
UIM's Weigh is being started with this picture only% of the top 50 iPhone screens, so you can imagine that the image looks distorted.
I have been able to improve it using the following code:
UIImageView * halfView = [[UIImageView alloc] initWithImage: Image]; [Self.view addSubview: halfView]; HalfView.frame = CGRectMake (0, 0, self.view.bounds.size.width, self.view.frame.size.height / 2); HalfView.contentMode = UIViewContentModeScaleAspectFill;
The only problem is that, the last UIImageView called "semicolon" is still slightly distorted.
I figured it is impossible to decide because the original photo is being taken with full iPhone screen and can never fully scale to fit a UIImageView that only the iPhone screen Takes up to 50% of the top.
I was originally trying to copy the frontback app. When you are taking the original image in your app, it looks like this:
When you are taking pictures, my app looks like the screen:
And then right after taking the picture, the screen of my app looks like a frontback screen and the picture you have taken And it takes it in the top half and it pam Tries to on.
I hope that makes sense. I know that this is a long question, but I really wanted to use the full screen while the user took the picture and then wanted to scale it on half the screen.
Am I going about all this wrong? Am I crazy to think that when I was originally captured as a "full screen" image, can I scale the image properly on half the screen?
Thanks for the help. For rationality, we say that the size you captured is 640x1136 (iPhone 5 screen size twice) and you are trying to display it. In a UIImageView
with 320x284 size (half size of the iPhone 5 screen). As you can already see from these dimensions, the width of the captured image is smaller than its height, whereas the width of UIImageView
is greater than its height - the proportions are different.
Therefore, scaling the captured image to fit the width of (<0.50>) to increase the width of UIImageView
means that the captured image size will be 320x568 - its height UIImageView
is higher than the height. Scaling the captured image to fit the UIImageView
height (from 0.25 to the scale) means that the captured image size will be 160x284 - its width is UIImageView
.
The image can not be exactly as you want it to scale. However, you can use UIViewContentModeScaleAspectFill
to fill the entire UIImageView
, but lose some images (the height of the image is too large to fit) you < Code> UIViewContentModeScaleAspectFit , which will display the entire picture, but will leave some space in the sides (the image width is too small).
You have another option in fact, capture the image in the proportion of your UIImageView
in the first place, but that means you will not be able to capture full screen image.
Comments
Post a Comment