0

I have created a ContainerView in Xamarin, which automatically created a new ViewController.

enter image description here

I have created the class for this called Test1ViewController:

using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace test1
{
    public partial class Test2ViewController : UIViewController
    {
        public Test2ViewController (IntPtr handle) : base (handle)
        {
        }

    }
}

I am trying to reference this view controller in the ViewDidLoad() method of the main view controller. However if I put the following:

Test2ViewController.PresentViewController(picker, true, null);

I get a static error message, which makes sense as I am trying to reference the class not the specific object. Am I missing something, how do I reference the UIViewController in the ContainerView from the parent UIViewController?

What I am trying to achieve, is including the Scandit Barcode scanner within the container view:

        // Setup the barcode scanner
        var picker = new ScanditSDK.SIBarcodePicker ("API-KEY");
        picker.OverlayController.Delegate = new BarcodeScanner ();

        Test2ViewController.PresentViewController(picker, true, null);
        picker.StartScanning ();
Joseph
  • 2,706
  • 6
  • 42
  • 80

1 Answers1

0

Assuming that variable picker is supposed to represent a Test2ViewController instance:

public override void ViewDidLoad()
{
  base.ViewDidLoad();

  this.picker = new Test2ViewController(); 
  this.PresentViewController(picker, true, null);  
}
Oliver Weichhold
  • 10,259
  • 5
  • 45
  • 87