Example #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            panningScrollView = new UIScrollView(View.Bounds)
            {
                AutoresizingMask     = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                BackgroundColor      = UIColor.Blue,
                WeakDelegate         = this,
                ScrollEnabled        = false,
                AlwaysBounceVertical = false,
                MaximumZoomScale     = 2f,
            };
            panningScrollView.PinchGestureRecognizer.AddTarget(PinchRecognized);
            View.AddSubview(panningScrollView);

            panningImageView = new UIImageView(View.Bounds)
            {
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                BackgroundColor  = UIColor.Red,
                ContentMode      = UIViewContentMode.ScaleAspectFit
            };
            panningScrollView.AddSubview(panningImageView);

            scrollbarView = new ImagePanScrollBarView(View.Bounds, new UIEdgeInsets(0, 10, 50, 10))
            {
                AutoresizingMask       = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                UserInteractionEnabled = false,
            };
            View.AddSubview(scrollbarView);

            displayLink = CADisplayLink.Create(DisplayLinkUpdate);
            displayLink.AddToRunLoop(NSRunLoop.Main, NSRunLoop.NSRunLoopCommonModes);

            View.AddGestureRecognizer(new UITapGestureRecognizer(ToggleMotionBasedPan));
        }
Example #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            panningScrollView = new UIScrollView (View.Bounds) {
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                BackgroundColor = UIColor.Blue,
                WeakDelegate = this,
                ScrollEnabled = false,
                AlwaysBounceVertical = false,
                MaximumZoomScale = 2f,
            };
            panningScrollView.PinchGestureRecognizer.AddTarget (PinchRecognized);
            View.AddSubview (panningScrollView);

            panningImageView = new UIImageView (View.Bounds) {
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                BackgroundColor = UIColor.Red,
                ContentMode = UIViewContentMode.ScaleAspectFit
            };
            panningScrollView.AddSubview (panningImageView);

            scrollbarView = new ImagePanScrollBarView (View.Bounds, new UIEdgeInsets (0, 10, 50, 10)) {
                AutoresizingMask =  UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                UserInteractionEnabled = false,
            };
            View.AddSubview (scrollbarView);

            displayLink = CADisplayLink.Create (DisplayLinkUpdate);
            displayLink.AddToRunLoop (NSRunLoop.Main, NSRunLoop.NSRunLoopCommonModes);

            View.AddGestureRecognizer (new UITapGestureRecognizer (ToggleMotionBasedPan));
        }