Monotouch Dialog Cannot exit ILIST because Backbutton is missing,

class fahrzeug

    {
        [Entry ("Typ")]
        public string typ;
        [Entry ("Name")]
        public string name;
        [RadioSelection("ListOfString")]
        public int selected=0;
        public IList<string> ListOfString;


    }
    public override void ViewWillAppear (bool animated)
    {
        base.ViewWillAppear (animated);
        Fahrzeug x = new Fahrzeug();
        x.typ="Neuwagen";
        x.name="BMW X3";
        x.ListOfString=new List<string>();
        x.ListOfString.Add("asdf");
        x.ListOfString.Add("bsdf");
    var bc= new BindingContext(null,x,"asdf");
        var dv = new MonoTouch.Dialog.DialogViewController(bc.Root,true);
        dv.WantsFullScreenLayout=false;
        dv.View.BackgroundColor=UIColor.DarkGray;


    this.startview.AddSubview(dv.View);

Hello, I have the code above. startview is not fullscreen, there is a navbar above, the normal dv is also outside the navigator, but when I click on ILISt to change the value, ILIST is fullscreen, so I can’t go back ... it’s also important that the actual UIView, I want is it in uiview, .. and I want to use reflection, because then I can directly serialize data to any ideas?

+3
source share
3 answers

, "" . DialogViewController.cs , "pushing". true, "" ​​ .

+9

"" UINavigationController. UINavigationController DialogViewController, DialogViewController.

:

var ui = new UINavigationController (dv);

"ui" , (, ):

PresentModalViewController (ui, shouldAnimate);

DialogViewController , , TweetStation TweetStation/UI/Timeline.cs .

+3

I had the same problem, and the reason was that the "Title" was missing, so the navigation controller without a name does not show the "back" button.

The solution was easy when I generated root elements, which I forgot for the name for the first root, like this:

var root = new RootElement("Settings"){ // <-- IMPORTANT! A title must be set here(!)
        new Section("Current server"){
            new RootElement("Server", new RadioGroup (0)){
                //...
            }
        },

My legacy DialogViewController constructor, for example:

public partial class SettingsViewController : DialogViewController
{
    public SettingsViewController () :
        base (UITableViewStyle.Grouped, null, true)
    {
        Root = GetRoot();
    }

It works like a charm; -)

By the way: in the field of view, I add a button and reload the data:

public override void ViewWillAppear (bool animated)
{
        NavigationItem.SetRightBarButtonItem(
            new UIBarButtonItem("Add Server", UIBarButtonItemStyle.Plain, (sender,args) => {
            // button was clicked

            NavigationController.PushViewController(new AddServerDialogViewController(), true);

        }), true);

        //TableView.SetEditing(true, true);

        ReloadData();

        base.ViewWillAppear(true);
}
+1
source

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


All Articles