MonoTouch.Dialog.PagingViewController.DidRotate C# (CSharp) Method

DidRotate() public method

public DidRotate ( UIInterfaceOrientation fromInterfaceOrientation ) : void
fromInterfaceOrientation UIInterfaceOrientation
return void
        public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
        {
            base.DidRotate (fromInterfaceOrientation);

            scrollView.Frame = new RectangleF(0,0,baseView.Bounds.Width,baseView.Bounds.Height-36);
            pageControl.Frame = new RectangleF(0,baseView.Bounds.Height-36,baseView.Bounds.Width,36);

            int count = pageControl.Pages;

            RectangleF scrollFrame = scrollView.Frame;
            scrollFrame.Width = scrollFrame.Width * count;
            scrollView.ContentSize = scrollFrame.Size;

            for (int i=0; i<count; i++)
            {
                RectangleF frame = scrollView.Frame;
                PointF location = new PointF();
                location.X = frame.Width * i;

                frame.Location = location;

                scrollView.Subviews[i].Frame = frame;

            }

            float pageOffset = scrollView.Frame.Width*pageControl.CurrentPage;

            PointF p = new PointF(pageOffset, 0);
            scrollView.SetContentOffset(p,true);
        }