Changing View size using user touch input - iphone

I want to change my view size using user touch input.
What I know and will be trying is using TouchesMoved method and then finding the nearest vertex of the view to the touch, make the view increase in that direction using animation.
But there are few problems I have before I start.
1) The camera app has same functionality in cropping photo. There is a grid displaying actual crop area. I don't know how to display that grid. I don't have any knowledge of opengl. I would like to have that as a indication of user is in edit mode?
2) The camera app crop functionality is also of changing the size using user touch input but it only changes view size, if the touch is near the four vertices of the view. From what I know there is a method to check if the touch is in a specific rect CGRectContainsPoint but how do I filter it to bounds of the view?
Edit
I tried yinkou answer, downloaded from Git.
Now the real question is in the git Xcode project. There is a view which has image as a contentView and if user drag that view, the image also changes shape based on view resizing.
I am doing this in a camera app. I attached AVCaptureVideoPreviewLayer as a contentView. Now my view is resizing but the AVCaptureVideoPreviewLayer stays the same size. Am I doing something wrong or is it that AVCaptureVideoPreviewLayer won't increase?

And happily, there's a control out there:
https://github.com/spoletto/SPUserResizableView

Related

How to zoom a selected area of image like pupil meter?

I have to show in zoom of a selected area of image continuously. Means if you are changing position simultaneously zoom also to be change. I don't know how to implement this.
UIScrollView has a great method - zoomToRect:animated: - that allows you to zoom on a specific rect. If you have a UIImageView sitting on a UIScrollView then you can zoom around the image view using this one simple method.

Customization of UIImagePickerController

I am working on camera application in which I want to set the screen of the camera i.e camera window appear for particular frame. And in front of camera screen the cut out image is coming so that user can see the background through the cut out part of the image and capture the image. So any one know to do this i.e. customization of UIImagePickerController.
UIImagePickerController has a property named cameraOverlayView. Use this to set your camera overlay as any view you like. Use normal view transparency for letting the user see parts of the live camera view.

Display 2 images at the same time in UIScrollView

I'm quite new to iPhone development, and now dealing with a remote control app. Currently I can receive desktop image and perform simple mouse operations. But I still want to show a mouse pointer on my iPhone screen.
The desktop (very big, 1280X800) is in a image view which is the subview of a scroll view. Is there any way I can add a pointer image on top of the desktop image, and set it to any place I want? The pointer image do not receive any user interaction, it would be just floating on the desktop image.
Thank you very much for help.
Yes, just create a new UIImageView (or any other UIView subclass) with a frame based on where you want it to appear and add it to the scroll view's view using the addSubview: method. By default subviews you add later will appear above subviews you add earlier, but you can explicitly control which view appears on 'top' using 'bringSubviewToFront:'.

UIScrollView content to track a CAKeyFrameAnimation along a path

In my App I have a full-screen UIScrollView where the content is a UIImageView containing a map image which is about 2000px square (i.e. larger than the UIScrollView).
Currently, I plot a path across the map and animate a "beacon" image along it using a CAKeyFrameAnimation, which works great.
What I would like to be able to do is to make the UIScrollView content move with the animation in such a way as to keep the beacon image in the centre of the screen (giving the user the impression of tracking along the path).
Any suggestions on how I might achieve this?

Zooming in UIScrollView is not smooth

I created a minesweeper clone game in iphone. My implementaion of the cells in the grid is this, I created a UIView and added buttons in the UIView and then I added the UIView in a UIScrollView, but every time I zoom out or zoom in using zoomToRect method of UIScrollView the zooming is not smooth and the zoom out was distorted. How can implement smooth zooming in UIScrollView?
I would try rendering your content view into a bitmap image when scrolling or zooming begins, and replacing the large grid of buttons with the bitmap until the scrolling/zooming is completed. The UIScrollViewDelegate protocol should provide you with the necessary information to know when to swap the bitmap in or out. Part of the problem is that your content view is so computationally intensive to render (all those buttons).
A more sophisticated approach would be to re-implement your game grid at a lower level using coreanimation and more fundamental touch event handling, but that might be overkill if the bitmap hack works well enough.
You know how in the maps app, while panning or zooming, there are grey tiles that show up? That means that the iPhone is currently downloading the tiles. In Safari, there is a similar effect where Safari lays down checkered grey instead of webpage, as it is currently rendering it and will be just a moment. Both of these mean that scrolling will not wait for content to load before displaying the area, it will let scrolling be smooth.
You could try looking here [http://stackoverflow.com/questions/1098234/optimized-image-loading-in-a-uiscrollview] for some ideas, and a point in the right direction would be to use threading to load views in the background while displaying grey in its place.