adding a UIView on a UIScrollVIew during the zoom mode - iphone

i'm trying to place a UIView on a scrollView during its zoomed state. I want the UIView to be seen on the scrollView and also to resize along with it once the scrollView is zoomed out.. i am able to place the UIView on scrollView during the zoomed state. But the UIView is not getting resized after zooming out... Should i apply any transforms here??? can anyone help me in this please... Thank you

You can use a little trick: before zoom is started get the screenshot of the view (with subviews) that you want to zoom. Add that image to the UIImageView add return it via viewForZoomingInScrollView:. So you actually zoom the image of that view and not the one itself.
After zoom ended scale your actual view manually.
You can find out how to get screen shot from my post here

Related

Possible to Limit Zooming / Panning Area in UIScrollView?

I have a UIViewController that implements a UIScrollView with the UIScrollViewDelegate. Attached to it is an UIImageView for which the user must crop the photo via zooming it and panning to fill the entire length of the screen. After the user has finished cropping and they hit done, the original UIImage gets sent to the next UIViewController.
I'm wondering, is there anyway, using the original image, to display it in a UIScrollView and allow the user to zoom and pan it so ONLY the cropped area gets shown? IE none of the image that was outside of the cropped area gets shown in zooming and panning? Is there a way to do this without explicitly cropping the image?
This might head you in the right direction: Displaying part of an image
Not to sure if this will work with the way you are displaying it. But if it does it could be a simple solution. You can also read through UIScrollviews and maybe use panGestureRecognizer and pinchGestureRecognizer to limit the area they can zoom and pan.
Set the content size of the UIScrollView to the rect of the cropped area.

UIScrollView is Zooming but every thing on scrollview is also zooming?

I am using a scrollview and I am zooming my scrollview.
I want that if i zoom my scrollview only background imageview which in the Scrollview can zoom and a small image on scrollview should not zoom.
Consider a map , if i am zooming map the map zooms but a placemark on that map would remain as it is in terms of size and place..
Same thing i want with my scrollview.
Any help please?
you can add the image view on top of the zooming scroll-view. The order in which the sub-views are added will matter here. So, first add the scroll view that zooms and then the image view

rotation of images in UIScrollView

resizing images inside UIScrollView when rotating the iphone.
I have a series of images placed on the UIScrollView (some images are placed one on top of the other). When I rotate the scrollview at some page, the topmost image on the hierarchy is expected to rotate which happens but the image goes to the first page of the scrollView. Any help on what could be going wrong would be appreciated.
thanks
DKV
I think the imageView which is misbehaving w.r.t to its frame is not added into correct super view. I think you should check that all imageView are added onto scrollView (if you want to show one imageView above another imageView make frame of both the imageView same, avoid adding one imageView onto another imageView).

Iphone Custom Scrollview indicator

I am currently working on an application for a client, and they have made an odd request. The request involves putting a custom image as the indicator for the scrollview. I am not even sure if this is possible but if it is can you please let me know how one would go about doing that.
Thanks
UIScrollView streches a small, semi-transparent circle image to generate its scrollbars. You can find this image as the first subview of a UIScrollView:
UIImageView *circle = [scrollView.subviews objectAtIndex:0];
However, as I said this image is stretched, and as far as I can tell, only the alpha values are considered when drawing the scroll bars.
So for example if you're only interested in changing the top/bottom ends of the scroll bar, you can try to change this image. However, I doubt you'll be able to do anything interesting.
A possible solution that comes to mind, and this is only a theory, is to add a custom, transparent UIView on top of a UIScrollView. Then you can hide the default scroll bar (by using showsHorizontalScrollIndicator and showsVerticalScrollIndicator), pass the necessary touch events to the UIScrollView to scroll the content, and draw the scrollbars in your custom view.

iPhone - strange issue with UIScrollView and touches

I have two UIImageView objects inside my view (both 320x480 one above the other). The lower image view is inside a UIScrollView with scrolling and zooming enabled. Now I want to handle touches inside the other image view but it no longer detects any single taps.
I can understand that the UIScrollView handles all the touches which I do on it. But the touches on the image view above the scroll view are also not recognized.
Attached is an image with my view hierarchy. Can someone please tell me why the other image view's touches are also handled by the scrollview when it isn't a subview of scroll view?
And if the scrollview is bent on handling touches, how do I recognize touches on the other image view?
Thanks.
By default UIImageViews have userInteractionEnabled=NO;
Try setting it to YES (either in IB or in code).
I'm not sure, it might be that you need to set the frame size and/or content size of the scroll view properly. This page has a diagram of what I'm talking about.