예제 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TweetButton.TouchUpInside += delegate {
                slComposer = SLComposeViewController.FromService(SLServiceType.Twitter);

                if (Screenshot.Image != null)
                {
                    slComposer.AddImage(Screenshot.Image);
                }

                slComposer.CompletionHandler += (result) => {
                    slComposer.DismissViewController(true, null);
                };
                PresentViewController(slComposer, true, null);
            };

            PostButton.TouchUpInside += delegate {
                slComposer = SLComposeViewController.FromService(SLServiceType.Facebook);

                if (Screenshot.Image != null)
                {
                    slComposer.AddImage(Screenshot.Image);
                }

                slComposer.CompletionHandler += (result) => {
                    slComposer.DismissViewController(true, null);
                };
                PresentViewController(slComposer, true, null);
            };

            #region Menu Buttons
            CloseButton.TouchUpInside += delegate {
                UIApplication.SharedApplication.SetStatusBarHidden(false, UIStatusBarAnimation.Fade);
                DismissViewController(true, null);
            };

            PrevBtn.TouchUpInside += delegate {
                SwipeImage("Right");
            };

            NextBtn.TouchUpInside += delegate {
                SwipeImage("Left");
            };
            #endregion

            #region Gesture Recognizers
            UITapGestureRecognizer tapGesture = new UITapGestureRecognizer();
            tapGesture.NumberOfTapsRequired = 1;
            tapGesture.AddTarget(this, new Selector("MenuDisplay"));
            Screenshot.AddGestureRecognizer(tapGesture);

            UISwipeGestureRecognizer swipeLeftGesture = new UISwipeGestureRecognizer();
            swipeLeftGesture.AddTarget(this, new Selector("SwipeLeftGesture"));
            swipeLeftGesture.Direction = UISwipeGestureRecognizerDirection.Left;
            View.AddGestureRecognizer(swipeLeftGesture);

            UISwipeGestureRecognizer swipeRightGesture = new UISwipeGestureRecognizer();
            swipeRightGesture.AddTarget(this, new Selector("SwipeRightGesture"));
            swipeRightGesture.Direction = UISwipeGestureRecognizerDirection.Right;
            View.AddGestureRecognizer(swipeRightGesture);

            UISwipeGestureRecognizer swipeDownGesture = new UISwipeGestureRecognizer();
            swipeDownGesture.AddTarget(this, new Selector("SwipeDownGesture"));
            swipeDownGesture.Direction = UISwipeGestureRecognizerDirection.Down;
            View.AddGestureRecognizer(swipeDownGesture);
            #endregion
        }