MonoTouch.Dialog: item back to NavigationBar

It’s hard for me to handle this. My MainWindow.xib has a NavigationController whose view inherits from another xib .

Now I am pushing the DialogViewController out of the main view, but I do not see the back button in the navigation bar of the second view.

Is there anything specific I need to set for the DialogViewController when it UIViewController out of the UIViewController .

Thank you and respectfully Abhishek

+6
source share
4 answers

The constructor for DialogViewController has a parameter called pushing, which you must set to true:

 new DialogViewController(rootElement, true); // true will show the back button 
+14
source

Without seeing my code, I don’t know exactly what is going on here. However, from what I know about the UINavigationController , the view controller stack is empty. When you click on the first view controller, it gives the navigation controller the view to display, but it has nothing to return, so it does not display the back button. If you click the second image, you can get the back button.

Also, make sure the Title property is set on the child view controllers if you want the back button to reflect the view you are returning to.

+2
source

I have a tab bar controller, which then goes to the navigation controller (in the storyboard using flyoutnavcontollers too). One of the viewcontrollers from here runs in the dialogviewcontroller for the material MT.D.

I wanted the beautiful pointy / narrowed back button from the monotouch dialog to return to my call point in the navigation controller.

But starting in MT.D loses navigation, even when im uses the current navigation controller for some reason, that is, the button does not appear and cannot return. Subsequent mt.d screens give a back button.

Apparently you should pass a true boolean call to enable the back button, and by clicking on the existing stack, but that did not help me:

 this.NavigationController.PushViewController (dv, true); 

Dan above solution does not work for me. But the appearance of the current dialog manager, while on the root screen, MT.D helps to return to my previous position in the original navigation controller in the storyboard (or flyoutnav controller).

Not sure if this hack is correct, but it works.

 dv.NavigationItem.RightBarButtonItem = new UIBarButtonItem("Back",UIBarButtonItemStyle.Bordered,delegate(object sender,EventArgs e) { NavigationController.PopViewControllerAnimated(true); }); 

* update

I managed to get the back button by adding a dialogviewcontroller to the current viewcontrollers subview:

  dvc = new MyDvcController(this.NavigationController); this.View.AddSubview(dvc.TableView); 

the corresponding MyDvcController basically looks like this:

 public partial class MyDvcController : DialogViewController { public MyDvcController (UINavigationController nav): base (UITableViewStyle.Grouped, null) { navigation = nav; Root = new RootElement ("Demos"){ new Section ("Element API"){ new StringElement ("iPhone Settings Sample", DemoElementApi), } }; } } 

this allowed monotouch.dialog to be part of the current stack of navigation controllers and get an automatic return button with a narrowed look. yay

0
source

You can also implement it yourself

 dialogViewController.NavigationItem.RightBarButtonItem = new UIBarButtonItem("Back",UIBarButtonItemStyle.Bordered,delegate(object sender,EventArgs e) { NavigationController.DismissModalViewControllerAnimated(true); }); 
-1
source

Source: https://habr.com/ru/post/904069/


All Articles