コード例 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            CGRect screenSize = UIScreen.MainScreen.Bounds;

            _cropperView = new HIPImageCropperView(
                frame: this.View.Bounds,
                cropSize: new CGSize(300, 300),
                position: HIPImageCropperView.CropperViewPosition.Center);

            this.View.AddSubview(_cropperView);

            _cropperView.SetOriginalImage(new UIImage("Images/portrait.jpg"));

            UIButton captureButton = new UIButton(UIButtonType.RoundedRect);
            captureButton.SetTitle("Capture", UIControlState.Normal);
            captureButton.SizeToFit();
            captureButton.Frame = new CGRect(this.View.Frame.Width - captureButton.Frame.Width - 10,
                this.View.Frame.Height - captureButton.Frame.Height - 10,
                captureButton.Frame.Width, captureButton.Frame.Height);

            captureButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin;
            captureButton.TouchUpInside += DidTapCaptureButton;
            this.View.AddSubview(captureButton);

            nfloat buttonSize = screenSize.Width / 3;

            for (int i = 0; i < 3; i++)
            {
                UIButton photoButton = new UIButton(UIButtonType.Custom);
                photoButton.TouchUpInside += DidTapPhotoButton;

                photoButton.Frame = new CGRect(i * buttonSize, 0, buttonSize, 50);

                string buttonTitle = string.Empty;

                switch (i)
                {
                    case 0:
                        buttonTitle = "Portrait";
                        break;
                    case 1:
                        buttonTitle = "Landscape";
                        break;
                    case 2:
                        buttonTitle = "Wide";
                        break;
                    default:
                        break;
                }

                photoButton.SetTitle(buttonTitle, UIControlState.Normal);

                this.View.AddSubview(photoButton);

                _photoButtons.Add(photoButton);
            }
        }
コード例 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            CGRect screenSize = UIScreen.MainScreen.Bounds;

            _cropperView = new HIPImageCropperView(
                frame: this.View.Bounds,
                cropSize: new CGSize(300, 300),
                position: HIPImageCropperView.CropperViewPosition.Center);

            this.View.AddSubview(_cropperView);

            _cropperView.SetOriginalImage(new UIImage("Images/portrait.jpg"));

            UIButton captureButton = new UIButton(UIButtonType.RoundedRect);

            captureButton.SetTitle("Capture", UIControlState.Normal);
            captureButton.SizeToFit();
            captureButton.Frame = new CGRect(this.View.Frame.Width - captureButton.Frame.Width - 10,
                                             this.View.Frame.Height - captureButton.Frame.Height - 10,
                                             captureButton.Frame.Width, captureButton.Frame.Height);

            captureButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin;
            captureButton.TouchUpInside   += DidTapCaptureButton;
            this.View.AddSubview(captureButton);


            nfloat buttonSize = screenSize.Width / 3;

            for (int i = 0; i < 3; i++)
            {
                UIButton photoButton = new UIButton(UIButtonType.Custom);
                photoButton.TouchUpInside += DidTapPhotoButton;

                photoButton.Frame = new CGRect(i * buttonSize, 0, buttonSize, 50);

                string buttonTitle = string.Empty;

                switch (i)
                {
                case 0:
                    buttonTitle = "Portrait";
                    break;

                case 1:
                    buttonTitle = "Landscape";
                    break;

                case 2:
                    buttonTitle = "Wide";
                    break;

                default:
                    break;
                }


                photoButton.SetTitle(buttonTitle, UIControlState.Normal);

                this.View.AddSubview(photoButton);

                _photoButtons.Add(photoButton);
            }
        }