public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.White; var width = View.Bounds.Width; var scanButton = new UIButton(UIButtonType.RoundedRect) { Frame = new RectangleF(50, 50, width - 100, 44), AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin, }; scanButton.SetTitle("Scan", UIControlState.Normal); scanButton.TouchUpInside += (o, e) => { var barcodeReader = new ZBarReaderViewController(); barcodeReader.ReaderDelegate = new BarcodeReaderCallback(this); barcodeReader.SupportedOrientations = ZBarOrientation.All; barcodeReader.ShowsZBarControls = true; // Access the inner ZBarImageScanner to tweak scanner settings. var scanner = barcodeReader.Scanner; // Disable all symbol types. scanner.SetSymbolOption(ZBarSymbolType.All, ZBarConfig.Enabled, 0); // Then for this sample enable just QR. scanner.EnableSymbol(ZBarSymbolType.QRCode); PresentViewController(barcodeReader, true, null); }; View.AddSubview(scanButton); resultsLabel = new UILabel(new RectangleF(10, 110, width - 20, 200)) { AutoresizingMask = UIViewAutoresizing.FlexibleDimensions, Lines = 0, Font = UIFont.SystemFontOfSize(14), }; View.AddSubview(resultsLabel); }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.White; var width = View.Bounds.Width; var scanButton = new UIButton(UIButtonType.RoundedRect) { Frame = new RectangleF(50,50,width-100,44), AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin, }; scanButton.SetTitle("Scan", UIControlState.Normal); scanButton.TouchUpInside += (o,e) => { var barcodeReader = new ZBarReaderViewController(); barcodeReader.ReaderDelegate = new BarcodeReaderCallback(this); barcodeReader.SupportedOrientations = ZBarOrientation.All; barcodeReader.ShowsZBarControls = true; // Access the inner ZBarImageScanner to tweak scanner settings. var scanner = barcodeReader.Scanner; // Disable all symbol types. scanner.SetSymbolOption(ZBarSymbolType.All, ZBarConfig.Enabled, 0); // Then for this sample enable just QR. scanner.EnableSymbol(ZBarSymbolType.QRCode); PresentViewController(barcodeReader, true, null); }; View.AddSubview(scanButton); resultsLabel = new UILabel(new RectangleF(10,110,width-20,200)) { AutoresizingMask = UIViewAutoresizing.FlexibleDimensions, Lines = 0, Font = UIFont.SystemFontOfSize(14), }; View.AddSubview(resultsLabel); }