I have a problem with rotating UIImageView. As you look at the attached screenshot you will find that image is rotated but the frame of UIImageView has some unwanted empty area. The blue line around image is the frame of UIImageView.
How can I remove that empty area? And assign that much of frame which is require by image.
Related
I have a view UIView that by default has a UIImageView (the blue square in the included image) that is centered in this main view (the gray square in the included image). The main view has an added CALayer that serves as a border (window or mask — the yellow rectangle in included image) through which the image can be seen. The user uses gesture recognizers to pan (translate), pinch (scale), and rotate the image view's transform, but I'd like to give them the option of transforming the image so it completely fills the yellow border (all four corners), much the same way the iOS crop tool does (see attached gif). I've tried to figure out how I can calculate the correct scale factor, but now I'm wondering — is there some simple formula or function that can help me solve this problem?
stretch image right and left side
centre arrow remain as it is
i tried with it but centre down arrow position is not properly set by me.
You can't do this with sliced images.
The area between the edges will stretch or repeat in order to fill the area. You can't also preserver the centre section of an image this way.
What you might be better doing is creating a custom drawn view using either CALayer or drawRect.
I am trying to make a transition like APP Tinder.
Detail:
In Screen One there is a Vertical Rectangular UIImaveView with contentMode = Aspect Fill, so it hides some portion of Image to adujust Aspect Ratio.
In Screen Two (Detail Screen) the same image after transition has to to be passed, but the ImageView in Second screen is Square One.
I want to make a Morphing kind of Transition in which User should think that the same ImageView from Screen One become square one in Second one without stretching the Image.So What should i do?
Currently i am trying to get Frame of UIImage that is in visible area of UIImageView so that I can do some Logical stuff to achieve this. but can anyone help me to Get the Frame of Visible Portion of UIImage.
EDIT
Please Find out the Attached Image for understanding
I think there's a little ambiguity in the question: a frame must be specified in a coordinate system. But I think you're looking for a rect relative to the original, unclipped image.
If that's right, then the rect can be computed as follows. Say the image is called image, and the image view is imageView. The size of the rect is the size of the image view:
imageView.bounds.size
And, since aspect fill will center the oversized dimension, it's origin is:
CGPointMake((image.size.width - imageView.bounds.size.width) / 2.0, 0.0);
I have a UIImageView with an image, the view has been set to aspect fit therefore when I load new images the size of the image alters.
On top of that UIImageView is another UIImageView where I am allowing the user to draw a line around a person in the image.
This all works perfectly, however I am able to draw outwith the image(still in the UIImageView). Is it possible to restrict the boundaries of drawing to be the size of the image rather than the view?
I have worked out the width and height of images in the view, however when I put these in as parameters to drawInRect it no longer draws on screen.
This works perfectly for drawing in the complete view:
[self.drawImage.image drawInRect:CGRectMake(0,0,self.view.frame.size.width, self.view.frame.size.height)];
I am trying to display rotated text. The UILabel is added as a subview on a UIImageView. The UIImageView has a transform created via say CGAffineTransformMakeRotation(M_PI/4.0). The text of the UILabel renders fairly blurry cf. the title label (in the screenshot, the blue background 'What's ...').
Do you know how I can manage to make the rotated text render clearly?
I've already tried using an integral-based frame (which matters little since it'll be rotated), a non-clear background color, and setting the label to opaque=YES. Still blurry.
Thanks!
The problem is that your label is rendered in half pixel either in the origin of the frame or the rotation. Check the frame origin after rotation, or try to rotate it by M_PI/4.1 (4.2, 4.3, 4.4, 4.5 - even test values like 4.05 4.15..) until it renders normally. Also check the frame of the UILabel in the UIImageView, could be added at half pixel origin for ex. {0.5, 0.5} or something..