Up vote 0 down vote favorite share g+ share fb share tw.
I have taken a code called "TapToZoom" project in the ScrollViewSuite available at developer.apple.com/iphone. This "TapToZoom" allows the user zooms in the image when double tapping. My app is a little bit complicated with a UIImagePickerController.
That is, I first use an instance from UIImagePickerController to pick up an image from my local photo directory, and then try to "Tap" and "zoom". In my app, there is a UIImageView instance called "sourceImageView" which displays the image. I also have a button right at the bottom of the view.
In other words, the entire view consists of three components: one button, one UIImageView, and one UIScrollView. I set the image mode as "Scale to Fill". The code I wrote is as follows: - (void)viewDidLoad { imagePicker = UIImagePickerController alloc init; super viewDidLoad; imagePicker.
Delegate = self; // set the tag for the image view self. SourceImageView setTag:ZOOM_VIEW_TAG; // add gesture recognizers to the image view UITapGestureRecognizer *doubleTap = UITapGestureRecognizer alloc initWithTarget:self action:@selector(handleDoubleTap:); doubleTap setNumberOfTapsRequired:2; self. ImageScrollView addGestureRecognizer:doubleTap; // calculate minimum scale to perfectly fit image width, and begin at that scale float minimumScale = self.
ImageScrollView frame.size. Width / self. SourceImageView frame.size.
Width; self. ImageScrollView setMinimumZoomScale:minimumScale; self. ImageScrollView setZoomScale:minimumScale; } //define the GestureRecognizer - (void)handleDoubleTap:(UIGestureRecognizer *)gestureRecognizer { // double tap zooms in float newScale = sourceImageView.image.size.
Width / imageScrollView.frame.size. Width; CGRect zoomRect = self zoomRectForScale:newScale withCenter:gestureRecognizer locationInView:gestureRecognizer. View; self.
ImageScrollView zoomToRect:zoomRect animated:YES; } //pick an image from the local directory - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *image; NSURL *mediaUrl; mediaUrl = (NSURL *)info valueForKey:UIImagePickerControllerMediaURL; if (mediaUrl == nil) { image = (UIImage *) info valueForKey:UIImagePickerControllerEditedImage; if (image == nil) { //---original image selected--- image = (UIImage *) info valueForKey:UIImagePickerControllerOriginalImage; //---display the image--- self.sourceImageView. Image = image; //imageView setNeedsDisplay; } } //---hide the Image Picker--- picker dismissModalViewControllerAnimated:YES; } The image picker works fine. But after loading an image, the "doubletap" function does not respond.
Anyone has any idea. Thanks in advance. Uiscrollview uiimagepickercontroller zooming link|improve this question asked Dec 31 '11 at 1:27superstar_jy33.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.