How to navigate to ViewController in Xamarin iOS on RowSelected event

后端 未结 2 519
野的像风
野的像风 2021-01-21 04:59

I am having a TableView on my home screen which is inside a Navigation Controller. Now, when a row is selected, I want to show a MapView.

I want to get access to the Nav

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-21 05:47

    I wanted to navigate from IndexViewController To ViewController. I use the following code.

    IndexViewController owner;
    
        public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
                {
                    UIStoryboard board = UIStoryboard.FromName ("Main", null);
                    ViewController ctrl = (ViewController)board.InstantiateViewController ("viewControllerID");
                    owner.NavigationController.PushViewController (ctrl, true);
            }
    

提交回复
热议问题