UIScrollView did zoom but subview stay unchanged - ios

I'm currently developping an iPad app and I need a "Slideshow"
So I create a first UIScrollView which will be used as pager and in the viewDidLoad I use a "for" loop to put the content in the UIScrollView.
Here is the loop :
for (int i = 0; i < self.thumbs.count; i++) {
UIScrollView *subScroll = [[UIScrollView alloc]initWithFrame:CGRectMake(self.ThumbsSlider.frame.size.width * i, 0, self.ThumbsSlider.frame.size.width, self.ThumbsSlider.frame.size.height)];
[subScroll setDelegate:self];
[subScroll setScrollEnabled:YES];
[subScroll setBouncesZoom:YES];
[subScroll setClipsToBounds:YES];
[subScroll setContentMode:UIViewContentModeCenter];
subviewImage = [[AsyncImageView alloc] initWithFrame:CGRectMake(0 , 0, subScroll.frame.size.width, subScroll.frame.size.height)];
subviewImage.contentMode = UIViewContentModeScaleAspectFit;
subviewImage.userInteractionEnabled = YES;
subviewImage.image = [UIImage imageNamed:#"no-image.jpg"];
subviewImage.imageURL = [NSURL URLWithString:[self.thumbs objectAtIndex:i]];
[subScroll addSubview:subviewImage];
subScroll.minimumZoomScale = 1.0;
subScroll.maximumZoomScale = 3.0;
[[subScroll delegate]viewForZoomingInScrollView:subScroll];
[self.ThumbsSlider addSubview:subScroll];
}
When I launch the app on my iPad, there is no crashes.
But, when I try to zoom, the contentSize of my subScroll change but the subviewImage doesn't zoom !
Can someone explain me why ?
Thanks in advance !

Put this function in your controller
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
for (UIView *imageView in scrollView.subviews)
{
if ([imageView isKindOfClass:[AsyncImageView Class]])
{
return imageView;
}
}
return nil;
}
And remove below line from loop:
[[subScroll delegate]viewForZoomingInScrollView:subScroll];

Related

Nested UIScrollView not paging for Internal UIScrollView

I am trying to build a screen which has 2 UIScrollViews, 1 Main Scroll View which is used as a container and to scroll vertically (this is working fine).
Inside the Main Scroll View, is a second scroll view, which is used for display different images. This needs to be scrolled horizontally so it will page to other images which will also update content details displayed in the Main Scroll View.
When attempting to get these two features to work together, the paging functionality does not work, however if it is outside the main scroll view it will work but will not scroll with the rest of the content.
The Image Scroll View is being detected in the events as well, but doesn't show any ability to scroll.
Below are my 3 functions which are performing the work.
- (void)viewDidLoad
{
[super viewDidLoad];
// Set up the Image Scroll View
ImageScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0, screenWidth, homeImage)];
ImageScrollView.scrollEnabled = YES;
ImageScrollView.userInteractionEnabled=YES;
[ImageScrollView setPagingEnabled:YES];
[ImageScrollView setAlwaysBounceVertical:NO];
ImageScrollView.delegate = self;
// Set up the image array
NSArray *imagesArray = [NSArray arrayWithObjects:#"staff1big.png", #"staff2big.png", #"staff3big.png", nil];
// Create each image subview
for (int i = 0; i < [imagesArray count]; i++)
{
CGFloat xOrigin = i * ImageScrollView.frame.size.width;
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(xOrigin, 0, ImageScrollView.frame.size.width, ImageScrollView.frame.size.height)];
[imageView setImage:[UIImage imageNamed:[imagesArray objectAtIndex:i]]];
[ImageScrollView addSubview:imageView];
}
// Set the Content Size and Offset
[ImageScrollView setContentSize:CGSizeMake(ImageScrollView.frame.size.width * [imagesArray count], ImageScrollView.frame.size.height)];
[ImageScrollView setContentOffset:CGPointMake(screenWidth*currentIndex, 0)];
// Get the staff object
dataSource = [DataSource dataSource];
NSArray *staffArray = [dataSource getStaff];
// Setup the Pager Control
self.pageControl = [[UIPageControl alloc] init];
NSInteger placement = (screenWidth/2)-50;
self.pageControl.frame = CGRectMake(placement, homeImage-30, 100, 20);
self.pageControl.numberOfPages = [staffArray count];
self.pageControl.currentPage = currentIndex;
[self setStaff:staffArray[currentIndex]];
// Add the Main Scroll View
MainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight)];
MainScrollView.delegate = self;
MainScrollView.scrollEnabled = YES;
MainScrollView.userInteractionEnabled=YES;
// Add each object to the correct scroll view
[ImageScrollView addSubview:self.pageControl];
[MainScrollView addSubview:ImageScrollView];
[MainScrollView addSubview:lineView];
[self setDisplayContent]; // note the MainScrollView is added to the self.view in this method along with setting the content size to screenWidth and height is determine by the generated content.
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGFloat pageWidth = ImageScrollView.frame.size.width;
float fractionalPage = ImageScrollView.contentOffset.x / pageWidth;
NSInteger page = lround(fractionalPage);
currentIndex = page;
self.pageControl.currentPage = page;
[self displayContent];
}
- (void)displayContent
{
int i = currentIndex;
if (i < 0)
{
i = 0;
} else if (i > 2) {
i = 2;
}
[self setStaff:allStaff[i]];
// remove all from view
for(UIView *subview in [MainScrollView subviews]) {
[subview removeFromSuperview];
}
NSArray *imagesArray = [NSArray arrayWithObjects:#"staff1big.png", #"staff2big.png", #"staff3big.png", nil];
for (int i = 0; i < [imagesArray count]; i++)
{
CGFloat xOrigin = i * ImageScrollView.frame.size.width;
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(xOrigin, 0, ImageScrollView.frame.size.width, ImageScrollView.frame.size.height)];
[imageView setImage:[UIImage imageNamed:[imagesArray objectAtIndex:i]]];
[ImageScrollView addSubview:imageView];
}
[ImageScrollView setContentSize:CGSizeMake(ImageScrollView.frame.size.width * [imagesArray count], ImageScrollView.frame.size.height)];
[ImageScrollView setContentOffset:CGPointMake(screenWidth*currentIndex, 0)];
// Get the staff
dataSource = [DataSource dataSource];
NSArray *staffArray = [dataSource getStaff];
self.pageControl = [[UIPageControl alloc] init];
NSInteger placement = (screenWidth/2) - 50;
self.pageControl.frame = CGRectMake(placement, homeImage-30, 100, 20);
self.pageControl.numberOfPages = [staffArray count];
self.pageControl.currentPage = currentIndex;
[self setStaff:staffArray[currentIndex]];
[ImageScrollView addSubview:self.pageControl];
[MainScrollView addSubview:ImageScrollView];
[MainScrollView addSubview:lineView];
[self setDisplayContent];
}
I do need to refactor some of the code to make more efficient, but at this stage I am just trying to get the horizontal paging to scroll horizontally.
If anyone would possibly be able to help point me in the right direction as to how to fix this issue, it would be greatly appreciated.
Here is a visual of the UI that I am trying to keep but have the image scroll horizontal.
Staff Display

UIpagecontrol Need Animation Rigth to Left

Using UIControlpage in my application. load the image and display in page control successfully. but i want to display the images animation like right to left move. Using timer call page control and increase the array count.
//// using NSTimer to call function to show the animation.
[NSTimer scheduledTimerWithTimeInterval:5.0
target:self
selector:#selector(loadNextController)
userInfo:nil
repeats:YES];
ScrollViewPage = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 20, frameX, frameY)];
ScrollViewPage.pagingEnabled = YES;
ScrollViewPage.backgroundColor=[UIColor redColor];
ScrollViewPage.delegate = self;
ScrollViewPage.backgroundColor = [UIColor clearColor];
ScrollViewPage.contentSize = CGSizeMake(frameX, frameY);
ScrollViewPage.showsHorizontalScrollIndicator = NO;
ScrollViewPage.pagingEnabled = YES;
pageControl = [[UIPageControl alloc] init];
pageControl.frame = CGRectMake(100,self.view.frame.size.height-100,self.view.frame.size.width-200,100);
pageControl.numberOfPages = [_pageImages count];
pageControl.currentPage = 0;
[self.view addSubview: ScrollViewPage];
for(int i = 0; i < [_pageImages count]; i++)
{
NSURL *url = [NSURL URLWithString:[_pageImages objectAtIndex:i]];
NSData *data = [[NSData alloc] initWithContentsOfURL:url];
UIImage *tmpImage = [UIImage imageWithData:data];
_backgroundImageView = [[UIImageView alloc] initWithImage:tmpImage];
_backgroundImageView.frame = CGRectMake(frameX * i, 0.0, frameX, frameY);
[ScrollViewPage addSubview:_backgroundImageView];
}
ScrollViewPage.contentSize = CGSizeMake(frameX*[_pageImages count], frameY);
pageControl.backgroundColor=[UIColor orangeColor];
[self.view addSubview:pageControl];
[pageControl addTarget:self action:#selector(pageTurn:) forControlEvents:UIControlEventValueChanged];
///// Here call the timer function
- (void)loadNextController
{
pageControl.currentPage = (pageControl.currentPage+1)%self.pageImages.count;
ScrollViewPage.contentOffset = CGPointMake(pageControl.currentPage * self.view.bounds.size.width, 0);
}
Here i need to show left to right move in uipagecontrol. help me..
In general you should always write what is your current result, what is the expected result and what have you tried.
I can only guess the issue you are facing is there are no animations.
The scroll view has a method setContentOffset:animated which you can use to animate the transition. Another approach is to use UIView animateWithDuration and sett the offset in the method block.
Try any or both of these...
[ScrollViewPage setContentOffset:CGPointMake(pageControl.currentPage * self.view.bounds.size.width, 0) animated:YES];
Or
[UIView animateWithDuration:0.2 animations:^{
ScrollViewPage.contentOffset = CGPointMake(pageControl.currentPage * self.view.bounds.size.width, 0);
}];
EDIT: Loop images.
To loop images you really only need 2 images on the scroll view at the time. I will show you the concept with 3 and you can try and play around with it.
NSArray *allImages;
NSInteger currentIndex = 0;
UIScrollView *scrollView;
UIImageView *imageViews[3];
- (void)begin {
scrollView.contentSize = CGSizeMake(scrollView.frame.size.width*3.0, scrollView.frame.size.height); // always have 3 images at the time
scrollView.contentOffset = CGPointMake(scrollView.frame.size.width, 0.0); // put to center
for(int i=0; i<3; i++) {
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(scrollView.frame.size.width*i, 0.0, scrollView.frame.size.width, scrollView.frame.size.height)];
[scrollView addSubview:imageView];
imageView[i] = imageView;
}
[self layoutForIndex:currentIndex];
}
- (void)nextImage {
currentIndex++;
[self layoutForIndex:currentIndex];
scrollView.contentOffset = CGPointZero;
[scrollView setContentOffset:CGPointMake(scrollView.frame.size.width, 0.0) animated:YES]
}
- (void)layoutForIndex:(NSInteger)index {
if(allImages.count > 0) { // we need at least one image to do something
for(int i=0; i<3; i++) {
// do the circling
NSInteger imageIndex = index-1+i;
while(imageIndex < 0) imageIndex+=allImages.count;
while(imageIndex >= allImages.count) imageIndex-=allImages.count;
imageViews[i].image = imageViews[imageIndex];
}
}
}
But in general for what you are doing you do not even need a scroll view. On next you can simply add another image view next to the current one and then use the UIView animation to reposition both of the image views.

iOS - UIScrollView can scroll but cannot zoom

I want to zoom in/out UIScrollView that contains a UIImageView. With my code below I am only able to scroll the scroll view contents but cannot zoom it.
My view hierarchy looks like this:
- (UIView *) containerView
-- (UIView *) contentView
--- (UIScrollView *) scrollView
---- (UIImageView *) self.imageView
Code:
UIView *previousContentView = nil;
for (NSInteger i = 0; i < 2; i++) {
contentView = [self addRandomColoredView];
[containerView addSubview:contentView];
[containerView.topAnchor constraintEqualToAnchor:contentView.topAnchor].active = true;
[containerView.bottomAnchor constraintEqualToAnchor:contentView.bottomAnchor].active = true;
scrollView = [self addRandomScrollView];
[contentView addSubview:scrollView];
self.imageView = [[UIImageView alloc] init];
[self.imageView setImage:[imagesArray objectAtIndex:i]];
[self.imageView setTranslatesAutoresizingMaskIntoConstraints:false];
[scrollView addSubview:self.imageView];
if (previousContentView) {
[VerticalSeparatorView addSeparatorBetweenView:previousContentView secondView:contentView];
NSLayoutConstraint *width = [contentView.widthAnchor constraintEqualToAnchor:previousContentView.widthAnchor];
width.priority = 250;
width.active = true;
} else {
[containerView.leadingAnchor constraintEqualToAnchor:contentView.leadingAnchor].active = true;
}
[contentView.topAnchor constraintEqualToAnchor:scrollView.topAnchor].active = true;
[contentView.bottomAnchor constraintEqualToAnchor:scrollView.bottomAnchor].active = true;
[contentView.leadingAnchor constraintEqualToAnchor:scrollView.leadingAnchor].active = true;
[contentView.trailingAnchor constraintEqualToAnchor:scrollView.trailingAnchor].active = true;
[scrollView.topAnchor constraintEqualToAnchor:self.imageView.topAnchor].active = true;
[scrollView.bottomAnchor constraintEqualToAnchor:self.imageView.bottomAnchor].active = true;
[scrollView.leadingAnchor constraintEqualToAnchor:self.imageView.leadingAnchor].active = true;
[scrollView.trailingAnchor constraintEqualToAnchor:self.imageView.trailingAnchor].active = true;
previousContentView = contentView;
}
[containerView.trailingAnchor constraintEqualToAnchor:previousContentView.trailingAnchor].active = true;
- (UIView *)addRandomColoredView
{
UIView *someView = [[UIView alloc] init];
someView.translatesAutoresizingMaskIntoConstraints = false;
[someView setBackgroundColor:[UIColor blackColor]];
return someView;
}
-(UIScrollView *)addRandomScrollView
{
UIScrollView *scrollView = [[UIScrollView alloc] init];
[scrollView setDelegate:self];
[scrollView setTranslatesAutoresizingMaskIntoConstraints:false];
[scrollView setBackgroundColor:[UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0]];
[scrollView setMaximumZoomScale:2.5f];
[scrollView setMinimumZoomScale:0.5f];
[scrollView setZoomScale:scrollView.minimumZoomScale];
return scrollView;
}
#pragma mark - UIScrollViewDelegate
-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return self.imageView;
}
I believe the scrollView is getting its contentSize because it is showing the image and I can scroll. Why can't I zoom in or zoom out?
You have to specify a delegate for your scroll view, and then implement viewForZoomingInScrollView to tell it to zoom the image view:
- (UIView *)addScrollViewWithImageView {
UIScrollView *scrollView = [[UIScrollView alloc] init];
scrollView.translatesAutoresizingMaskIntoConstraints = false;
scrollView.maximumZoomScale = 200.0;
scrollView.minimumZoomScale = 0.1;
scrollView.delegate = self;
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"test.png"]];
imageView.translatesAutoresizingMaskIntoConstraints = false;
[self.view addSubview:scrollView];
[scrollView addSubview:imageView];
[NSLayoutConstraint activateConstraints:#[
[imageView.topAnchor constraintEqualToAnchor:scrollView.topAnchor],
[imageView.leftAnchor constraintEqualToAnchor:scrollView.leftAnchor],
[imageView.rightAnchor constraintEqualToAnchor:scrollView.rightAnchor],
[imageView.bottomAnchor constraintEqualToAnchor:scrollView.bottomAnchor]
]];
return scrollView;
}
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return scrollView.subviews.firstObject;
}
And then to populate these zoomable scroll views with image views, your viewDidLoad might look like:
- (void)viewDidLoad {
[super viewDidLoad];
UIView *previousContentView = nil;
for (NSInteger i = 0; i < 3; i++) {
UIView *contentView = [self addScrollViewWithImageView];
[self.view.leadingAnchor constraintEqualToAnchor:contentView.leadingAnchor].active = true;
[self.view.trailingAnchor constraintEqualToAnchor:contentView.trailingAnchor].active = true;
if (previousContentView) {
[HorizontalSeparatorView addSeparatorBetweenView:previousContentView secondView:contentView];
NSLayoutConstraint *height = [contentView.heightAnchor constraintEqualToAnchor:previousContentView.heightAnchor];
height.priority = 250;
height.active = true;
} else {
[self.view.topAnchor constraintEqualToAnchor:contentView.topAnchor].active = true;
}
previousContentView = contentView;
}
[self.view.bottomAnchor constraintEqualToAnchor:previousContentView.bottomAnchor].active = true;
}
Try MWPhotoBrowser. It has built in scroll and zoom functionality. You will get more than you need. Good Luck.

how to swipe the multiple images in single view in ios

I made multiple image swipping in single view.In that app,there is only one view that has an image on it. I want to be able to swipe left to right and right to left and have the first image go out of the view and the second image to come in.I am trying the code.But it is not worked for me.Please any body guide me.I am new to the image swipping.Thanks in advance.
scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 190)];
scrollView.showsVerticalScrollIndicator=YES;
scrollView.userInteractionEnabled=YES;
scrollView.delegate = self;
scrollView.scrollEnabled = YES;
scrollWidth = 120;
scrollView.contentSize = CGSizeMake(scrollWidth,80);
[self.view addSubview:scrollView];
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSError *err;
NSString *strResponse=[[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(#"response is %#",strResponse);
dict1=[NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:&err];
NSLog(#"vals are %#",dict1);
NSString *strImg;
url=#"myimageurl";
str=[dict1 valueForKey:#"image_names"];
arrImages=[str componentsSeparatedByString:#","];
for(int index=0; index < [arrImages count]; index++)
{
NSLog(#"image: %#",[arrImages objectAtIndex:index]);
if (str!=nil)
{
strImg=[url stringByAppendingString:[arrImages objectAtIndex:index]];
dispatch_async(dispatch_get_global_queue(0,0), ^{
NSData *data = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:strImg]];
if(data == nil) return;
dispatch_async(dispatch_get_main_queue(), ^{
UIImage *img=[UIImage imageWithData: data];
imgView.image=img;
});
});
}
}
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch * touch = [[event allTouches] anyObject];
for(int index=0;index<[arrImages count];index++)
{
UIImageView *imgView = [arrImages objectAtIndex:index];
NSLog(#"x=%f,y=%f,width =%f,height=%f",imgView.frame.origin.x,imgView.frame.origin.y,imgView.frame.size.width,imgView.frame.size.height);
NSLog(#"x= %f,y=%f",[touch locationInView:self.view].x,[touch locationInView:self.view].y) ;
if(CGRectContainsPoint([imgView frame], [touch locationInView:scrollview]))
{
[self ShowDetailView:imgView];
break;
}
}
}
First of all set the pagingEnabled property scrollview.pagingEnabled = YES;.
Then set the correct contentSize for the scrollView.
And last but not least you must set the width of contentSize to be a multiple of scrollView.frame.size.width.
I.E. If you have 3 images and your scrollView has a width of 320 pixel you contentSize must be 320x3 = 960 pixel
You may want to adjust scrollView.contentSize.width by amountOfImages * scrollWidth.
Beside this, you really should create a new object for every image.
It could handle image downloading, validating, and touch handling (even with a single transparent button upont the image). You could completly wipe out that weird touchesBegan code from your controller, and you could forget about coordinates entirely.
Also you could stop progressing downloads that have way scrolled out this way, so performance can grow.
.h file #import <UIKit/UIKit.h>
#interface ViewController : UIViewController<UIScrollViewDelegate,UIScrollViewAccessibilityDelegate>
{
UIScrollView *scrView;
NSMutableArray *arrimage;
UIImageView *imgview;
}
#end
.M file
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
[scrollView setBackgroundColor:[UIColor redColor]];
scrollView.contentSize = CGSizeMake(320, 465);
[scrollView setScrollEnabled:YES];
[scrollView setPagingEnabled:YES];
[scrollView setAlwaysBounceVertical:NO];
[self.view addSubview:scrollView];
arrimage = [[NSMutableArray alloc]initWithObjects:#"1.jpeg",#"2.jpeg",#"3.jpeg",#"4.jpeg",#"5.jpeg",#"6.jpeg",#"7.jpeg",#"8.jpeg",#"9.jpeg",#"10.jpeg", nil];
for (int i = 0; i < [arrimage count]; i++)
{
CGFloat xOrigin = i * scrollView.frame.size.width;
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(xOrigin, 0, scrollView.frame.size.width, scrollView.frame.size.height)];
[imageView setImage:[UIImage imageNamed:[arrimage objectAtIndex:i]]];
[imageView setContentMode:UIViewContentModeScaleAspectFit];
[scrollView addSubview:imageView];
}
[scrollView setContentSize:CGSizeMake(scrollView.frame.size.width * [arrimage count], scrollView.frame.size.height)];
}

How to pinch zoom multiple UIImageViews inside UIScrollView

I have to pinch zoom multiple images. I have added each of the UIImageView to UIView and added the UIView to UIScrollView. and returning the UIView image viewForZoomingInScrollView: delegate method, but images are not zooming as expected. is there any better way?
#define VIEW_FOR_ZOOM_TAG (1)
#implementation [SVViewController][1]
- (void)viewDidLoad {
[super viewDidLoad];
UIScrollView *mainScrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds];
mainScrollView.pagingEnabled = YES;
mainScrollView.showsHorizontalScrollIndicator = NO;
mainScrollView.showsVerticalScrollIndicator = NO;
CGRect innerScrollFrame = mainScrollView.bounds;
for (NSInteger i = 0; i < 3; i++) {
UIImageView *imageForZooming = [[UIImageView alloc] initWithImage:[UIImage imageNamed:
[NSString stringWithFormat:#"page%d", i + 1]]];
imageForZooming.tag = VIEW_FOR_ZOOM_TAG;
UIScrollView *pageScrollView = [[UIScrollView alloc] initWithFrame:innerScrollFrame];
pageScrollView.minimumZoomScale = 1.0f;
pageScrollView.maximumZoomScale = 2.0f;
pageScrollView.zoomScale = 1.0f;
pageScrollView.contentSize = imageForZooming.bounds.size;
pageScrollView.delegate = self;
pageScrollView.showsHorizontalScrollIndicator = NO;
pageScrollView.showsVerticalScrollIndicator = NO;
[pageScrollView addSubview:imageForZooming];
[mainScrollView addSubview:pageScrollView];
if (i < 2) {
innerScrollFrame.origin.x += innerScrollFrame.size.width;
}
}
mainScrollView.contentSize = CGSizeMake(innerScrollFrame.origin.x +
innerScrollFrame.size.width, mainScrollView.bounds.size.height);
[self.view addSubview:mainScrollView];
}
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return [scrollView viewWithTag:VIEW_FOR_ZOOM_TAG];
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
- (BOOL)shouldAutorotate {
return NO;
}
#end
[1]: http://www.lyricspoints.com
Check the minimum and maximum zoom scale properties of the scroll view. (max should be greater than min for zoom to happen)
make sure that you are returning the corresponding UIImageView and not the UIView
Make sure that you have set the scroll view delegate as the object to which you want the delegate messages of the scroll view to be sent, like viewForZoomingInScrollView:

Resources