public override void ViewDidLoad () { loadingBg = new UIView (this.View.Frame) { BackgroundColor = UIColor.Black }; loadingView = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge); loadingView.Frame = new RectangleF ((this.View.Frame.Width - loadingView.Frame.Width) / 2, (this.View.Frame.Height - loadingView.Frame.Height) / 2, loadingView.Frame.Width, loadingView.Frame.Height); loadingBg.AddSubview (loadingView); View.AddSubview (loadingBg); loadingView.StartAnimating (); scannerView = new ZXingScannerView(new RectangleF(0, 0, this.View.Frame.Width, this.View.Frame.Height)); scannerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; scannerView.UseCustomOverlayView = this.Scanner.UseCustomOverlay; scannerView.CustomOverlayView = this.Scanner.CustomOverlay; scannerView.TopText = this.Scanner.TopText; scannerView.BottomText = this.Scanner.BottomText; scannerView.CancelButtonText = this.Scanner.CancelButtonText; scannerView.FlashButtonText = this.Scanner.FlashButtonText; //this.View.AddSubview(scannerView); this.View.InsertSubviewBelow (scannerView, loadingView); this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; }
public override void ViewDidLoad () { scannerView = new ZXingScannerView(new RectangleF(0, 0, this.View.Frame.Width, this.View.Frame.Height)); scannerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; scannerView.UseCustomOverlayView = this.Scanner.UseCustomOverlay; scannerView.CustomOverlayView = this.Scanner.CustomOverlay; scannerView.TopText = this.Scanner.TopText; scannerView.BottomText = this.Scanner.BottomText; scannerView.CancelButtonText = this.Scanner.CancelButtonText; scannerView.FlashButtonText = this.Scanner.FlashButtonText; this.View.AddSubview(scannerView); this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; }
public override void ViewDidLoad () { scannerView = new ZXingScannerView(new RectangleF(0, 0, this.View.Frame.Width, this.View.Frame.Height)); scannerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.AddSubview(scannerView); this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; if (Scanner.UseCustomOverlay && Scanner.CustomOverlay != null) overlayView = Scanner.CustomOverlay; else overlayView = new ZXingDefaultOverlayView(this.Scanner, new RectangleF(0, 0, this.View.Frame.Width, this.View.Frame.Height), () => Scanner.Cancel(), () => Scanner.ToggleTorch()); if (overlayView != null) { overlayView.Frame = new RectangleF(0, 0, this.View.Frame.Width, this.View.Frame.Height); overlayView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.AddSubview(overlayView); this.View.BringSubviewToFront(overlayView); } }
public override void ViewDidLoad () { scannerView = new ZXingScannerView(new RectangleF(0, 0, this.View.Frame.Width, this.View.Frame.Height)); scannerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.AddSubview(scannerView); this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; if (Scanner.UseCustomOverlay && Scanner.CustomOverlay != null) overlayView = Scanner.CustomOverlay; else overlayView = new ZXingDefaultOverlayView(this.Scanner, new RectangleF(0, 0, this.View.Frame.Width, this.View.Frame.Height), () => Scanner.Cancel(), () => Scanner.ToggleTorch()); if (overlayView != null) { UITapGestureRecognizer tapGestureRecognizer = new UITapGestureRecognizer (); tapGestureRecognizer.AddTarget (() => { var pt = tapGestureRecognizer.LocationInView(overlayView); //scannerView.Focus(pt); Console.WriteLine("OVERLAY TOUCH: " + pt.X + ", " + pt.Y); }); tapGestureRecognizer.CancelsTouchesInView = false; tapGestureRecognizer.NumberOfTapsRequired = 1; tapGestureRecognizer.NumberOfTouchesRequired = 1; overlayView.AddGestureRecognizer (tapGestureRecognizer); overlayView.Frame = new RectangleF(0, 0, this.View.Frame.Width, this.View.Frame.Height); overlayView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.AddSubview(overlayView); this.View.BringSubviewToFront(overlayView); } }