Exemple #1
0
        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        public void SetLayout()
        {
            //TODO: remove new
            //imageView.Image = image;
            imageView.Dispose();
            imageView = new UIImageView(image);

            if (UIScreen.MainScreen.Bounds.Width > UIScreen.MainScreen.Bounds.Height)
            {
                ViewUtils.ExpandFullScreenProportion(scrollView, imageProportion);
                NavigationController.SetNavigationBarHidden(true, false);
            }
            else
            {
                scrollView.Frame = new CGRect(0, 57, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Width * imageProportion - 57 - 65);
                NavigationController.SetNavigationBarHidden(false, false);
            }

            scrollView.AddSubview(imageView);

            scrollView.ContentSize = new CGSize(scrollView.Frame.Width, scrollView.Frame.Height);

            scrollView.MaximumZoomScale = 5f;
            if (imageView.Image.Size.Width == 0)
            {
                scrollView.MinimumZoomScale = scrollView.MaximumZoomScale;
            }
            else
            {
                scrollView.MinimumZoomScale = scrollView.Frame.Width / imageView.Image.Size.Width;
            }
            scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return(imageView); };

            scrollView.SetZoomScale(scrollView.MinimumZoomScale, false);

            DeletePhotoButton.Frame = new CGRect((UIScreen.MainScreen.Bounds.Width - DeletePhotoButton.Frame.Width) / 2, UIScreen.MainScreen.Bounds.Height - 60, DeletePhotoButton.Frame.Width, DeletePhotoButton.Frame.Height);
        }