public override void ViewDidDisappear(bool animated) { base.ViewDidDisappear(animated); //remove identification view idView.RemoveFromSuperview(); idView.Dispose(); idView = null; //we have to erase the scan view so that there are no dependencies for the viewcontroller left. anylineMrzView.RemoveFromSuperview(); anylineMrzView.Dispose(); anylineMrzView = null; base.Dispose(); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Initializing the MRZ module. CGRect frame = UIScreen.MainScreen.ApplicationFrame; frame = new CGRect(frame.X, frame.Y + NavigationController.NavigationBar.Frame.Size.Height, frame.Width, frame.Height - NavigationController.NavigationBar.Frame.Size.Height); anylineMrzView = new AnylineMRZModuleView(frame); error = null; // We tell the module to bootstrap itself with the license key and delegate. The delegate will later get called // by the module once we start receiving results. success = anylineMrzView.SetupWithLicenseKey(licenseKey, this.Self, out error); // SetupWithLicenseKey:delegate:error returns true if everything went fine. In the case something wrong // we have to check the error object for the error message. if (!success) { // Something went wrong. The error object contains the error description (alert = new UIAlertView("Error", error.DebugDescription, null, "OK", null)).Show(); } //we'll manually cancel scanning anylineMrzView.CancelOnResult = false; // After setup is complete we add the module to the view of this view controller View.AddSubview(anylineMrzView); /* * ALIdentificationView will present the scanned values. Here we start listening for taps * to later dismiss the view. */ idView = new AnylineIdentificationView(new CGRect(0, 0, 300, 300 / 1.4f)); idView.AddGestureRecognizer(new UITapGestureRecognizer(this, new ObjCRuntime.Selector("ViewTapSelector:"))); idView.Center = View.Center; idView.Alpha = 0; View.AddSubview(idView); }