Problem with UIImageView when resizing UIView - iphone

This is the problem that I have:
I have an UIImageView inside an UIView.
Then I rotate the UIImageView 45 degrees using gestureRecognizers with 2 fingers.
Everything seem good now but when I start resize the UIView about -10px width, height by changing the UIView's frame, the UIImageView become very ugly, it does not resize with ratio.
It become stretch.
It does not happen when I rotate the image with 90 or 180 or 270 degrees. the UIImage resize OK.
Sorry for my bad English.
Tung Do

Redraw the image after the pinch.

Related

ClipsToBounds on a rotated superview

I am adding a subview on a rotated superview and want it to clip to the superviews bounds.
I know that the bounds are the rectangle around the rotated view and by knowing that I DON'T want to clip it to the superviews bounds but I want it to clip at the actual borders of the rotated superview.
How is that done?

How to enlarge/blow up/zoom a certain part of a UIImageView on iPhone?

I have a magnifying glass as a UIImageView subview of a UIView. I want to enlarge the part of the UIView that the magnifying glass is on. I can't figure out how to enlarge a certain part of the view. I assume it has to be a rectangle and not a circle? How could I blow it up? I don't have much CA experience so a shove in the right direction would help.
If you want to zoom a static image, then you can do this:
Make the magnifyingView (UIView) have a sub-view that's a UIImageView. The UIImageView has the same image that's being magnified, but much larger. Have the magnifyingView clip to bounds set. Then, as the UIView is moved by the user dragging/touching, the subview is moved in relation to that to create a magnify effect.
I'd have to look up how to magnify dynamic content myself.
I am about to do the same thing. Here is an example of how to capture a view in an image. You can then zoom in the image in the bubble:
UIGraphicsBeginImageContext(view.bounds.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
self.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

UIScrollView zoom after rotation

Allright, i have a UIScrollView with some drawings inside. the zoom and scroll works fine until i zoom in and then rotate. after the rotation zoom is fine but when i zoom back my drawings shrink more than i intend them to.
So basically, when i zoom out after rotation the view gets smaller than the screen.. how can i fix this problem ? any idea ?
I tried _scrollView.clipsToBounds = YES; but not working after the rotation.
Thanks
Have you tired to set min/max zoom scale on the UIScrollView ? Assuming you have a reference to the UIScrollView you can set the minimum zoom scale. This will ensure that when you zoom out you drawings won't shrink more than you want.
scrollView.minimumZoomScale = 1.00;

Iphone sdk, Rounded UIImageView FRAME corners, not just masking it

i am building a app in which if a UIImageView hits another something happens, i am using the CGRectIntersetsRect statement, i would like to make it as accurate as i can, at the moment i have about 8 UIImageViews inside this one UIImageView and i am detecting if something hits them 8 little views, i have decided that this is not a very accurate way to go about it. The problem is that the UIImageView the other UIImageView's are in, Its a Oval, so it is complicated, i have tryed masking it, using the
image.layer.radius 10.0 or whatever the code is.
but this doesnt actually transform the whole frame, is there any way to actually transform the whole frame so when a UIImageView hits the Oval shape then something happens?
if so could someone explain it to me.
Thanks
Harry
this is really simple indeed. As a View, UIImageView has a layer and a layer has cornerRadius properties:
imageView.layer.cornerRadius = 5.0;
imageView.layer.masksToBounds = YES;
eBuildy, iPhone specialists
A UIImageView's frame is a CGRect, a CGRect is a rectangle and a rectangle has no rounded properties.

iPhone - Center UIImage in UIImageView

I have a UIImageView. I get a UIImage from a URL. The image displays in the UIImageView, but I can't get it to center correctly. The UIImage is 80 x 68 pixels. The UIImaveView's size is 90 x 90. When I display the UIImage in the UIImageView the UIImage is shrunken so that it fits, although it is already smaller than the UIImageView. I have tried all the Content Modes in IB. Some of them shift the image up so that it is no longer in the UIImageView. None of this really makes sense to me. It seems that the UIImage should display inside the UIImageView fine if it is already within the required size. Any help would be great.
With Mode of Center on the UIImageView
alt text http://img406.imageshack.us/img406/3696/screenshot20090915at447.png
With Mode of Aspect Fit on the UIImageView
alt text http://img406.imageshack.us/img406/9373/screenshot20090915at447e.png
With Center, the size of the image seems correct but you can see that it goes out of the UIImageView which has a red UIView underneath it and is actually 2px on each side larger than the image view. But with the Aspect Fit, it makes the image smaller so that it fits inside. But I don't understand why it would make it smaller if it is already small enough to fit.
Sorry for wasting anyone's time. Turns out I didn't try all of the content modes. Seems that Content Mode of Bottom top works. This is backwards from how I understood it. Thanks for all your help.
Try this. Change your UIImageView to be the same size as the UIImage that you are going to load, then position the UIImageView so that it's centered. This is the approach I've taken since I find UIImageView to be a bit funny to work with. Or, if you prefer, skip the UIImageView and just draw the UIImage using it's - (void)drawInRect:(CGRect)rect method.
Sounds like your image contains transparent areas, at least at the bottom, which shift the image off center.
Edit: Also, you should check that the resolution of the image is set to 72dpi.