Tab bar controller - Changing view controllers for same tab item

JonShanksJonShanks GBMember
edited January 2016 in Xamarin.iOS


Struggling to try change the View Controller been shown in one of my Tab items.

I have three tab items and can display the view controller for each one without issue.

On the third view controller I trigger a QR Scanning camera on a button press (ViewController #1) which once it scans the QR Code then closes and forwards the user to a view controller (ViewController #2) using a PresentViewController call.

Thing is I need this 2nd view controller presented in place of the original #1 such that the Tab items are still presented at the bottom. Is this at all possible?

The code I am currently using on ViewController #1 to show the 2nd VC is as follows and works, its just showing the VC on top of the Tab Bar where as I need it to actually replace View Controller #1

UIStoryboard board = UIStoryboard.FromName ("Main", null);
VC_DisplayScanResult ctrl = (VC_DisplayScanResult)board.InstantiateViewController ("sbid_vcscanresult");
TabBarMain rootTabBar = (TabBarMain)this.ParentViewController;
rootTabBar.PresentViewController(ctrl, true, null);

I will eventually want to open a 3rd Viewcontroller from the 2nd.

I want to avoid Segues for this workflow.

Best Answer


Sign In or Register to comment.