[Vm-dev] iOS VM and useScrollingView

phil at highoctane.be phil at highoctane.be
Sat Mar 2 13:20:51 UTC 2013


I have been digging into the iOS VM a tad further.

Now, I wonder, what it the scrollview for? I isn't used by default I guess.

BOOL useScrollingView = [self.info useScrollingView];

	// PBK what's the scrolling view here?
	if (useScrollingView) {
		scrollView = [[UIScrollView alloc ] initWithFrame: mainScreenSize];

		//Now setup the true view size as the width/height * 2.0  so we can
have a larger squeak window and zoom in/out.
		CGRect fakeScreenSize = mainScreenSize;
		fakeScreenSize.origin.x = 0;
		fakeScreenSize.origin.y = 0;
		fakeScreenSize.size.width *= 2.0;
		fakeScreenSize.size.height *= 2.0;
		/* eToys setup
		 fakeScreenSize.size.width = 1200;
		 fakeScreenSize.size.height = 900;
		*/
		mainView = [[[self whatRenderCanWeUse] alloc] initWithFrame: fakeScreenSize];
		mainView.backgroundColor = [UIColor blackColor];
		mainView.multipleTouchEnabled = YES;
		mainView.autoresizingMask = UIViewAutoresizingNone;
		self.mainView.clearsContextBeforeDrawing = NO;
		
		//Setup the scroll view which wraps the mainView
		self.scrollView.scrollEnabled = useScrollingView;
		self.scrollView.clearsContextBeforeDrawing = NO;
		self.scrollView.canCancelContentTouches = NO;
		self.scrollView.minimumZoomScale = 0.5;
		self.scrollView.maximumZoomScale = 4.0;
		self.scrollView.delegate = self;
		self.scrollView.backgroundColor = [UIColor blackColor];
		self.scrollView.autoresizesSubviews=YES;
		self.scrollView.autoresizingMask=(UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleWidth);

		self.viewController.view = self.scrollView;		
		
		[self zoomToOrientation: UIInterfaceOrientationPortrait animated: NO];
		[self.scrollView addSubview: self.mainView];
		[window addSubview: self.scrollView];
		
	}


More information about the Vm-dev mailing list