public override async void ViewDidLoad() { base.ViewDidLoad(); TopMenuEvents(true, btnMonth, btnQuarter, btnHalfYear, btnYear); ClickServicesEvents(true, btnCost, btnQuality, btnService, btnAll); btnCost.TouchUpInside += btnOneTouch; btnQuality.TouchUpInside += btnTwoTouch; btnService.TouchUpInside += btnThreeTouch; btnAll.TouchUpInside += btnFourTouch; HttpServiceConn conn = new HttpServiceConn(); try { _Questions = await conn.GetQuestions(Token, Company); CreateButtonForGraphics(btnCost, btnQuality, btnService, btnAll); } catch (Exception ex) { UIAlertView error = new UIAlertView("Ошибка", ex.Message, null, "Закрыть", null); error.Show(); } btnMonth.SendActionForControlEvents(UIControlEvent.TouchUpInside); UISwipeGestureRecognizer gest = new UISwipeGestureRecognizer(); gest.Direction = UISwipeGestureRecognizerDirection.Right; gest.AddTarget(() => MoveBack(gest)); MainBackGroubd.AddGestureRecognizer(gest); }
public void IsRewardCollectionEmpty() { var itemsCount = CollectionView.Source.GetItemsCount(CollectionView, 0); if (itemsCount == 0) { EmptyCollectionView.Hidden = false; _swipe = new UISwipeGestureRecognizer(); _swipe.AddTarget(() => HideAreaCollection()); _swipe.Direction = UISwipeGestureRecognizerDirection.Up | UISwipeGestureRecognizerDirection.Down; EmptyCollectionView.AddGestureRecognizer(_swipe); _tap = new UITapGestureRecognizer(); _tap.AddTarget(() => HideAreaCollection()); EmptyCollectionView.AddGestureRecognizer(_tap); var data = NSData.FromFile("Images/panda-ohno.gif"); var image = AnimatedImageView.GetAnimatedImageView(data, ViewForImage); ViewForImage.Image = image.Image; ViewForImage.StartAnimating(); } if (itemsCount != 0) { EmptyCollectionView.Hidden = true; } }
UISwipeGestureRecognizer CreateSwipeRecognizer(SwipeDirection direction, Action <SwipeDirection> action, int numFingers = 1) { var result = new UISwipeGestureRecognizer(); result.NumberOfTouchesRequired = (uint)numFingers; result.Direction = (UISwipeGestureRecognizerDirection)direction; result.AddTarget(() => action(direction)); return(result); }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.Clear; Front = new FrontView(verses[0]); View.BackgroundColor = UIColor.FromPatternImage(Images.TableViewBackground); Back = new BackView(verses[position]); MemorizedImage = Images.HeartRedButton; NotMemorizedImage = Images.HeartGreyButton; TapGesture = new UITapGestureRecognizer { NumberOfTapsRequired = 1 }; TapGesture.AddTarget(TapHandler); SwipeUpGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Up }; SwipeUpGesture.AddTarget(FlipCardHandler); SwipeDownGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Down, }; SwipeDownGesture.AddTarget(FlipCardHandler); SwipeUpTwoFingersGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Up, NumberOfTouchesRequired = 2 }; SwipeUpTwoFingersGesture.RequireGestureRecognizerToFail(SwipeUpGesture); SwipeUpTwoFingersGesture.AddTarget(NextCardHandler); SwipeDownTwoFingersGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Down, NumberOfTouchesRequired = 2, }; SwipeDownTwoFingersGesture.RequireGestureRecognizerToFail(SwipeDownGesture); SwipeDownTwoFingersGesture.AddTarget(NextCardHandler); RightSwipeGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Right }; RightSwipeGesture.AddTarget(RightSwipeHandler); View.Add(Front); View.AddGestureRecognizer(SwipeUpGesture); View.AddGestureRecognizer(SwipeDownGesture); View.AddGestureRecognizer(SwipeUpTwoFingersGesture); View.AddGestureRecognizer(SwipeDownTwoFingersGesture); View.AddGestureRecognizer(RightSwipeGesture); View.AddGestureRecognizer(TapGesture); }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); float inset = 30.0f; float inset2 = 29.5f; AreaCollectionOutlet.Source = new AreaCollectionSource(); AreaCollectionOutlet.CollectionViewLayout = new UICollectionViewFlowLayout { ItemSize = new CGSize(138, 161), ScrollDirection = UICollectionViewScrollDirection.Horizontal, SectionInset = new UIEdgeInsets(inset2, inset2, inset2, inset2), MinimumInteritemSpacing = inset, MinimumLineSpacing = inset }; AreaCollectionOutlet.ReloadData(); if (NavigationController != null && !IsChangingAreasDisabled) { SwipeDown = new UISwipeGestureRecognizer(); SwipeDown.AddTarget(() => HandleDrag(SwipeDown)); SwipeDown.Direction = UISwipeGestureRecognizerDirection.Down; NavigationController.NavigationBar.AddGestureRecognizer(SwipeDown); (NavigationController as SLNavigationController)?.NavTitle?.AddGestureRecognizer(SwipeDown); Tap = new UITapGestureRecognizer { CancelsTouchesInView = false }; Tap.AddTarget(() => NavAreasClicked()); Tap.ShouldReceiveTouch += (recognizer, touch) => !(touch.View is UIControl); NavigationController.NavigationBar.AddGestureRecognizer(Tap); (NavigationController as SLNavigationController)?.NavTitle?.AddGestureRecognizer(Tap); Debug.WriteLine(@"Added Swipe Down Gesture " + this.Class.Name); } if (_isLoaded) { HideAreaCollection(); } else { ShowAreaCollection(); } }
public ArticleViewController(Cluster cluster, DateTime needsUpdate) : base("ArticleViewController", null) { this.articles = cluster.Articles; index = 0; this.needsUpdate = needsUpdate; articleDisplays = new UIView[articles.Count]; clicked = new bool[articles.Count]; gestureLeft = new UISwipeGestureRecognizer(); gestureLeft.Direction = UISwipeGestureRecognizerDirection.Left; gestureLeft.AddTarget(() => HandleSwipe(index + 1)); View.AddGestureRecognizer(gestureLeft); gestureRight = new UISwipeGestureRecognizer(); gestureRight.Direction = UISwipeGestureRecognizerDirection.Right; gestureRight.AddTarget(() => HandleSwipe(index - 1)); View.AddGestureRecognizer(gestureRight); }
private void SetPreviewSizing(AVCaptureDevice device, bool restart) { var sideHeight = NativeView.Bounds.Height; var sideWidth = NativeView.Bounds.Width; if (_liveCameraStream == null || restart) { _liveCameraStream = new UIView(new CGRect(0, 0, sideWidth, sideHeight)); var singleTapGesture = new UITapGestureRecognizer { NumberOfTapsRequired = 1 }; singleTapGesture.AddTarget(() => PreviewWasTapped(singleTapGesture)); _liveCameraStream.AddGestureRecognizer(singleTapGesture); var doubleTapGesture = new UITapGestureRecognizer { NumberOfTapsRequired = 2 }; doubleTapGesture.AddTarget(() => TurnOffFlashAndSetContinuousAutoMode(device)); _liveCameraStream.AddGestureRecognizer(doubleTapGesture); var swipeGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Left | UISwipeGestureRecognizerDirection.Right }; swipeGesture.AddTarget(() => PreviewWasSwiped(swipeGesture)); _liveCameraStream.AddGestureRecognizer(swipeGesture); } else { _liveCameraStream.Frame = new CGRect(0, 0, sideWidth, sideHeight); } if (_avCaptureVideoPreviewLayer == null || restart) { _avCaptureVideoPreviewLayer = new AVCaptureVideoPreviewLayer(_captureSession); _liveCameraStream.Layer.AddSublayer(_avCaptureVideoPreviewLayer); } _avCaptureVideoPreviewLayer.Frame = _liveCameraStream.Bounds; }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.Clear; Front = new FrontView(reviewableVerses[0]); View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(Images.TableViewBackground)); Back = new BackView(reviewableVerses[position]); MemorizedImage = UIImage.FromFile(Images.HeartRedButton); NotMemorizedImage = UIImage.FromFile(Images.HeartGreyButton); TapGesture = new UITapGestureRecognizer { NumberOfTapsRequired = 1 }; TapGesture.AddTarget(FlipCardHandler); SwipeUpGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Up }; SwipeUpGesture.AddTarget(NextCardHandler); SwipeDownGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Down, }; SwipeDownGesture.AddTarget(NextCardHandler); RightSwipeGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Right }; RightSwipeGesture.AddTarget(RightSwipeHandler); HandleProductTourStep6(); View.Add(Front); View.AddGestureRecognizer(SwipeUpGesture); View.AddGestureRecognizer(SwipeDownGesture); View.AddGestureRecognizer(RightSwipeGesture); View.AddGestureRecognizer(TapGesture); }
public override void ViewDidLoad() { base.ViewDidLoad (); View.BackgroundColor = UIColor.Clear; Front = new FrontView (reviewableVerses[0]); View.BackgroundColor = UIColor.FromPatternImage (UIImage.FromFile (Images.TableViewBackground)); Back = new BackView (reviewableVerses[position]); MemorizedImage = UIImage.FromFile (Images.HeartRedButton); NotMemorizedImage = UIImage.FromFile (Images.HeartGreyButton); TapGesture = new UITapGestureRecognizer { NumberOfTapsRequired = 1 }; TapGesture.AddTarget (FlipCardHandler); SwipeUpGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Up }; SwipeUpGesture.AddTarget (NextCardHandler); SwipeDownGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Down, }; SwipeDownGesture.AddTarget (NextCardHandler); RightSwipeGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Right }; RightSwipeGesture.AddTarget (RightSwipeHandler); HandleProductTourStep6 (); View.Add (Front); View.AddGestureRecognizer (SwipeUpGesture); View.AddGestureRecognizer (SwipeDownGesture); View.AddGestureRecognizer (RightSwipeGesture); View.AddGestureRecognizer (TapGesture); }
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 }
private void GestureFuch() { UISwipeGestureRecognizer sgrRight = new UISwipeGestureRecognizer (); UISwipeGestureRecognizer sgrLeft = new UISwipeGestureRecognizer (); sgrRight.AddTarget (this, RightSwipeSelector); sgrLeft.AddTarget (this, LeftSwipeSelector); sgrRight.Direction = UISwipeGestureRecognizerDirection.Right; sgrLeft.Direction = UISwipeGestureRecognizerDirection.Left; sgrRight.Delegate = new SwipeRecogniserDelegate (); sgrLeft.Delegate = new SwipeRecogniserDelegate (); View.AddGestureRecognizer (sgrLeft); View.AddGestureRecognizer (sgrRight); }
private static void Register(View view, UIView uiview) { foreach (var elementsGestureRecognizer in view.GestureRecognizers) { TypeSwitch.Do(elementsGestureRecognizer, TypeSwitch.Case<XF.GestureRecognizers.TapGestureRecognizer>(gestureRecognizer => { var platformGestureRecognizer = new UITapGestureRecognizer { NumberOfTapsRequired = gestureRecognizer.NumberOfTaps, NumberOfTouchesRequired = gestureRecognizer.NumberOfTouches, ShouldRecognizeSimultaneously = (a, b) => true }; var eventArgs = new iOS_TapGestureEventArgs(gestureRecognizer, platformGestureRecognizer); platformGestureRecognizer.AddTarget(() => { if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter)) { gestureRecognizer.Command.Execute(eventArgs); } }); uiview.AddGestureRecognizer(platformGestureRecognizer); }), TypeSwitch.Case<LongPressGestureRecognizer>(gestureRecognizer => { var platformGestureRecognizer = new UILongPressGestureRecognizer { NumberOfTapsRequired = gestureRecognizer.NumberOfTaps, NumberOfTouchesRequired = gestureRecognizer.NumberOfTouches, MinimumPressDuration = gestureRecognizer.MinimumDuration, ShouldRecognizeSimultaneously = (a, b) => true }; var eventArgs = new iOS_LongPressGestureEventArgs(gestureRecognizer, platformGestureRecognizer); platformGestureRecognizer.AddTarget(() => { if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter)) { gestureRecognizer.Command.Execute(eventArgs); } }); uiview.AddGestureRecognizer(platformGestureRecognizer); }), TypeSwitch.Case<PanGestureRecognizer>(gestureRecognizer => { var platformGestureRecognizer = new UIPanGestureRecognizer { MaximumNumberOfTouches = gestureRecognizer.MaximumNumberOfTouches, MinimumNumberOfTouches = gestureRecognizer.MinimumNumberOfTouches, ShouldRecognizeSimultaneously = (a, b) => true }; var eventArgs = new iOS_PanGestureEventArgs(gestureRecognizer, platformGestureRecognizer); platformGestureRecognizer.AddTarget(() => { if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter)) { gestureRecognizer.Command.Execute(eventArgs); } }); uiview.AddGestureRecognizer(platformGestureRecognizer); }), TypeSwitch.Case<XF.GestureRecognizers.PinchGestureRecognizer>(gestureRecognizer => { var platformGestureRecognizer = new UIPinchGestureRecognizer { ShouldRecognizeSimultaneously = (a, b) => true }; var eventArgs = new iOS_PinchGestureEventArgs(gestureRecognizer, platformGestureRecognizer); platformGestureRecognizer.AddTarget(() => { if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter)) { gestureRecognizer.Command.Execute(eventArgs); } }); uiview.AddGestureRecognizer(platformGestureRecognizer); }), TypeSwitch.Case<SwipeGestureRecognizer>(gestureRecognizer => { var platformGestureRecognizer = new UISwipeGestureRecognizer { Direction = (UISwipeGestureRecognizerDirection)gestureRecognizer.Direction, ShouldRecognizeSimultaneously = (a, b) => true }; var eventArgs = new iOS_SwipeGestureEventArgs(gestureRecognizer, platformGestureRecognizer); platformGestureRecognizer.AddTarget(() => { if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter)) { gestureRecognizer.Command.Execute(eventArgs); } }); uiview.AddGestureRecognizer(platformGestureRecognizer); }), TypeSwitch.Case<RotationGestureRecognizer>(gestureRecognizer => { var platformGestureRecognizer = new UIRotationGestureRecognizer { ShouldRecognizeSimultaneously = (a, b) => true }; var eventArgs = new iOS_RotateGestureEventArgs(gestureRecognizer, platformGestureRecognizer); platformGestureRecognizer.AddTarget(() => { if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter)) { gestureRecognizer.Command.Execute(eventArgs); } }); uiview.AddGestureRecognizer(platformGestureRecognizer); }) ); } }
public DieRollerView() { Roller = this; BackgroundColor = CMUIColors.PrimaryColorDark; ClipsToBounds = true; _TitleButton = new GradientButton(); _TitleButton.SetText("Die Roller"); _TitleButton.Font = UIFont.BoldSystemFontOfSize(17); _TitleButton.CornerRadius = 0; _TitleButton.TouchUpInside += (object sender, EventArgs e) => { Collapsed = !Collapsed; }; _OutputView = new UIWebView(); _RollButton = new GradientButton(); _RollButton.TouchUpInside += RollButtonClicked; _RollButton.SetText("Roll"); _RollButton.SetImage(UIExtensions.GetSmallIcon("dice"), UIControlState.Normal); _RollButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 7); _RollButton.CornerRadius = 0; _RollButton.Gradient = new GradientHelper(CMUIColors.SecondaryColorADarker, CMUIColors.SecondaryColorADark); _RollButton.Font = UIFont.BoldSystemFontOfSize(17); _ClearButton = new GradientButton(); _ClearButton.TouchUpInside += ClearButtonClicked; _ClearButton.SetText("Clear"); _ClearButton.CornerRadius = 0; _ClearButton.Font = UIFont.BoldSystemFontOfSize(17); _ClearButton.Gradient = new GradientHelper(CMUIColors.SecondaryColorBDarker, CMUIColors.SecondaryColorBDark); _ClearHtmlButton = new GradientButton(); _ClearHtmlButton.TouchUpInside += _ClearHtmlButtonClicked; _ClearHtmlButton.SetText("Reset"); _ClearHtmlButton.SetImage(UIExtensions.GetSmallIcon("reset"), UIControlState.Normal); _ClearHtmlButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 7); _ClearHtmlButton.Font = UIFont.BoldSystemFontOfSize(17); _ClearHtmlButton.CornerRadius = 0; _ClearHtmlButton.Gradient = new GradientHelper(CMUIColors.SecondaryColorADarker, CMUIColors.SecondaryColorADark); _BottomView = new GradientView(); _BottomView.ClipsToBounds = true; _BottomView.Gradient = new GradientHelper(CMUIColors.PrimaryColorDarker); Add(_TitleButton); Add(_OutputView); Add(_BottomView); Add(_ClearHtmlButton); _BottomView.AddSubviews(_RollButton, _ClearButton); BringSubviewToFront(_BottomView); _DieButtons = new List <UIButton>(); foreach (var v in new int [] { 4, 6, 8, 10, 12, 20, 100 }) { GradientButton b = new GradientButton(); b.CornerRadius = 0; b.SetText(v.ToString()); b.Tag = v; b.TouchUpInside += DieClicked; UIImage im = null; switch (v) { case 4: case 6: case 8: case 10: case 12: case 100: im = UIExtensions.GetSmallIcon("d" + v); break; case 20: im = UIExtensions.GetSmallIcon("d20p"); break; } if (im != null) { b.BonusImage = im; b.ContentEdgeInsets = new UIEdgeInsets(25, 0, 0, 0); } _BottomView.AddSubview(b); _DieButtons.Add(b); UISwipeGestureRecognizer rec = new UISwipeGestureRecognizer(); rec.Direction = UISwipeGestureRecognizerDirection.Up | UISwipeGestureRecognizerDirection.Down; rec.Delegate = new SwipeGestureDelegate(); rec.AddTarget(this, new ObjCRuntime.Selector("HandleDieSwipe:")); _Recs[rec] = b; b.AddGestureRecognizer(rec); } _DieTextButton = new GradientButton(); CMStyles.TextFieldStyle(_DieTextButton); _BottomView.Add(_DieTextButton); _DieTextButton.TouchUpInside += DieTextButtonClicked; _DieTextButton.TitleLabel.AdjustsFontSizeToFitWidth = true; BringSubviewToFront(_TitleButton); }
public IGSingleImageViewController(List <IGImage <TKey> > images, int imageIndex, UrlImageStore <TKey> imageStore) : base() { this.Images = images; this.ImageIndex = imageIndex; this.ImageStore = imageStore; this.scrollView = new UIScrollView(this.View.Bounds); this.scrollView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.scrollView.BackgroundColor = UIColor.Black; this.scrollView.ScrollEnabled = true; this.scrollView.MinimumZoomScale = 0.5f; this.scrollView.MaximumZoomScale = 3.0f; var img = this.Images[this.ImageIndex]; this.Title = img.Title; bool showActivity = !this.ImageStore.Exists(img.Id); UIImage imgUI = this.ImageStore.RequestImage(img.Id, img.Url, this); this.imageView = new UIImageView(imgUI); this.imageView.Frame = scrollView.Bounds; this.imageView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.scrollView.Delegate = new ScrollViewDelegate(this.imageView); this.scrollView.AddSubview(this.imageView); this.scrollView.ContentSize = this.imageView.Image.Size; this.View.AddSubview(this.scrollView); float descHeight = this.View.StringSize(this.Images[imageIndex].Caption, UIFont.SystemFontOfSize(13.0f), new SizeF(this.View.Bounds.Width - 10, this.View.Bounds.Height - 15), UILineBreakMode.WordWrap).Height; this.descriptionView = new UITextView(new RectangleF(0, this.View.Frame.Height - descHeight - 15 - 44, this.View.Frame.Width, descHeight + 15)); this.descriptionView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; this.descriptionView.Text = this.Images[imageIndex].Caption; this.descriptionView.BackgroundColor = UIColor.Black.ColorWithAlpha(0.5f); this.descriptionView.Font = UIFont.SystemFontOfSize(13.0f); this.descriptionView.TextColor = UIColor.White; this.descriptionView.Editable = false; this.View.AddSubview(this.descriptionView); this.activityView = new UIActivityIndicatorView(new RectangleF((this.View.Bounds.Width - 30) / 2, (this.View.Bounds.Height - 30) / 2, 30, 30)); this.activityView.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin; this.activityView.Hidden = !showActivity; this.activityView.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge; this.View.AddSubview(this.activityView); if (showActivity) { this.activityView.StartAnimating(); } //this.activityView.StartAnimating(); //this.Title = this.Images[imageIndex].Title; tapGesture = new UITapGestureRecognizer(); tapGesture.NumberOfTapsRequired = 1; tapGesture.DelaysTouchesEnded = true; tapGesture.DelaysTouchesBegain = true; tapGesture.AddTarget(this, TapSelector); this.View.AddGestureRecognizer(tapGesture); swipeLeft = new UISwipeGestureRecognizer(); swipeLeft.Direction = UISwipeGestureRecognizerDirection.Left; swipeLeft.Delegate = new SwipeRecognizerDelegate(); swipeLeft.AddTarget(this, SwipeLeftSelector); this.View.AddGestureRecognizer(swipeLeft); swipeRight = new UISwipeGestureRecognizer(); swipeRight.Direction = UISwipeGestureRecognizerDirection.Right; swipeRight.Delegate = new SwipeRecognizerDelegate(); swipeRight.AddTarget(this, SwipeRightSelector); this.View.AddGestureRecognizer(swipeRight); this.scrollView.DelaysContentTouches = true; }
public override void ViewDidLoad () { base.ViewDidLoad (); _gallery = new PhotoGallery(); image.ContentMode = UIViewContentMode.ScaleToFill; setPhoto(_gallery.getCurrentPhoto()); // gestures (RIGHT) UISwipeGestureRecognizer sgrRight=new UISwipeGestureRecognizer(); sgrRight.AddTarget(this,RightSwipeSelector); sgrRight.Direction=UISwipeGestureRecognizerDirection.Right; sgrRight.Delegate=new SwipeRecogniserDelegate(); View.AddGestureRecognizer(sgrRight); // gestures (LEFT) UISwipeGestureRecognizer sgrLeft=new UISwipeGestureRecognizer(); sgrLeft.AddTarget(this,LeftSwipeSelector); sgrLeft.Direction=UISwipeGestureRecognizerDirection.Left; sgrLeft.Delegate=new SwipeRecogniserDelegate(); View.AddGestureRecognizer(sgrLeft); // Perform any additional setup after loading the view, typically from a nib. }