Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

pashik

macrumors member
Original poster
Jul 16, 2008
43
0
Is it possible to make UIScrollView to work as UIWebView, that is:
user can scroll to some place and zoom it out/in but rectangle of UIScrollView won't be zoomed out - just view inside UIScrollView will be zoomed out.
E.g. in this code
Code:
	sview = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0,320, 460)];
	sview.autoresizesSubviews = YES;
	sview.delegate = self;
	sview.userInteractionEnabled = YES;
	sview.minimumZoomScale = 0.25;
	sview.maximumZoomScale = 2;
	sview.scrollEnabled  =YES;
	sview.bounces = YES;
	sview.bouncesZoom = YES;
	sview.contentSize = CGSizeMake(3200, 4600);
	sview.scrollsToTop = NO;
	sview.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
	
	UIView *block = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 3200, 4600)]; 
	block.backgroundColor = [UIColor blueColor];
	//add some elements to view
	
	[sview addSubview:block];

...
-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{
return sview;
}

I set background color of view inside UIScrollView to blue.
When i make zoomout - i can see only that rectangle 320x240 is zoomed out (so blue square become small) but the rest part of view is not visible though i can scroll it (scroll inside blue view) without problem.
So how to make so that i can see blue view and it will be zoomed out in whole screen and not in rectagle 320x240?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.