I got some problem when i'm zooming, when i zoom the next UIImageView goes above the UIImageView i m zooming in.
I load my UIImageView in a subclass of a UIScrollView that i call in controller. The load function and Scroll function work perfectly.
The first problem is that when I zoom in the next UIImageView goes above the one that i m zooming in.
So i tried to put every UIImageView in a UIView that i put into the ScrollView but it does the same things...
The 2nd problem that I have is that when i zoom in, my scroll doesn't work anymore.
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor blackColor];
scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
scroll.pagingEnabled=YES;
NSInteger numberOfViews = 6;
for (int i = 0; i < numberOfViews; i++) {
CGFloat xOrigin = i * self.view.frame.size.width;
image=[[UIImageView alloc]initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%d",i]]];
image.frame=CGRectMake(xOrigin, 0, self.view.frame.size.width, self.view.frame.size.height);
[scroll addSubview:image];
}
scroll.maximumZoomScale=6.0;
scroll.minimumZoomScale=0.5;
scroll.delegate=self;
scroll.clipsToBounds=YES;
scroll.contentSize = CGSizeMake(self.view.frame.size.width * numberOfViews, self.view.frame.size.height);
[self.view addSubview:scroll];
}
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return image;
}
I know that there are questions similar to this but nothing helps my cause.Any suggested changes in my code to make it correct is more than appreciated.
scroll.pagingEnabled = YES;? Also, how do you zoom when you have min/max zoom scales equal to 1.0 ? - NeverHopeless