dear all daniweb users,
i start using xamarin to create ios software.
in mainstoryboard, i navigate passcodevc view controller to songlistvc view controller.
i use scandit barcode scanner script in passcodevc.cs .
after barcode scanner script, i want navigate from passcodevc view controller to songlistvc view controller. i use this code and did not auto navigate :

var storyBoard = UIStoryboard.FromName ("MainStoryboard", null);
storyBoard.InstantiateViewController ("SongListVC");

try this one too but also not auto navigate :

PasscodeVCViewController *viewController = segue.SongListVCViewController;
viewController.delegate = self;

both code tried but did not work.
i know it it easier use button to create push seque to songlistvc view controller, but i did not want it.
what i want is auto redirect after scandit barcode scanner code(in passcodevc.cs and passcodevc view controller) to songlistvs view controller.
how to did that without push button?
please help me.

regards.

Dani AI

Generated

tried instantiating the view controller but never actually performed a visible transition. Instantiating a UIViewController just creates an object — it must be pushed onto a UINavigationController, presented modally, or shown via a storyboard segue. Also, scanner callbacks often run off the main thread, so any UI work must be dispatched to the main thread (or the transition may silently fail).

Programmatic push/present example (run on the main thread from the scan callback):

InvokeOnMainThread(() =>
{
    var dest = Storyboard?.InstantiateViewController("SongListVC") as SongListVC;
    if (dest == null) return;                 // bad storyboard ID / class
    if (NavigationController != null)
        NavigationController.PushViewController(dest, true);
    else
        PresentViewController(dest, true, null);
});

If a segue was created in Interface Builder, trigger it on the main thread and use PrepareForSegue to pass data:

InvokeOnMainThread(() => PerformSegue("ShowSongListSegue", this));

Troubleshooting checklist (common causes seen in threads like this):

  • Confirm the destination’s Storyboard ID exactly matches the string (case-sensitive).
  • If Storyboard is null, use UIStoryboard.FromName("Main", null) — names differ by project.
  • If the app uses a modal scanner UI, dismiss it first (DismissViewController) then perform the transition inside the dismiss completion handler.
  • Ensure only one navigation happens per scan (guard a boolean flag to avoid duplicate pushes).
  • Add logs or breakpoints in the scan callback and right before the push/present to confirm execution order and threading.

Reference posts: this addresses the instantiation attempts from and provides the actionable navigation patterns that was asking about.

tried this one too but also did not work:

UIViewController songlist = new SongListVC ();
songlist.Transition (PasscodeVC, SongListVC);

Hi

have you found a solution to the problem

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.