0

I have a monotouch dialog view controller. I have a number of nested root elements

        public RootElement LoginSection()
    {
        //var rootSection = new Section("");
        var root = new RootElement ("I'm already a member");

        EntryElement emailEnt = new EntryElement ("Login","Username or Email","");
        EntryElement passwdEnt = new EntryElement ("Password","Password","",true);

        StyledStringElement loginBtn = new StyledStringElement ("Login"){
            Accessory = UITableViewCellAccessory.DetailDisclosureButton
        };
        Section loginDetails = new Section("Your Details"){emailEnt,passwdEnt,loginBtn};
        loginBtn.Tapped += () => {
            var result = ApiOperations.ApiValidateLoginCredentials (emailEnt.Value, passwdEnt.Value);
            if (result) {
                var login = DataOperations.DbGetLogin ();
                //first time user so we need to save their details into the db
                if (login == null) {

                } else {
                    BTProgressHUD.Show ("Logging In", -1, BTProgressHUD.MaskType.Black);
                    BTProgressHUD.InvokeInBackground (delegate {
                        ApiOperations.QrCode (login.ConsumerId);
                        ApiOperations.ApiConsumer (login.ConsumerId);
                        AuthenicatedActionCompleted.Invoke (this, new EventArgs ());
                        BTProgressHUD.Dismiss ();
                    });
                }
            } else {
                //didnt work
                using (var alert = new UIAlertView ("Unable to login", "Please try again.", null, "OK", null))
                    alert.Show ();
            }
        };
        root.Add (loginDetails);
        return root;
        }

My problem is the the length of each of the element titles. My top level root title is also long e.g. Welcome to my application

If I tap on an rootelement above the back button shows "welcome to...." ideally I would like the button to show "back" vs the long string.

Is it possible to update this?

Diver Dan
  • 9,953
  • 22
  • 95
  • 166

1 Answers1

1

Ok solved it. If anyone else has the same problem this worked for me.

The last line is the trick.

public override void LoadView ()
    {
        base.LoadView ();
        View.BackgroundColor =UIColor.Clear;
        TableView.BackgroundView = null;
        var background = UIImage.FromBundle(Resources.BackgroundImagePath);
        ParentViewController.View.BackgroundColor = UIColor.FromPatternImage (background);
        this.NavigationItem.BackBarButtonItem = new UIBarButtonItem ("Back", UIBarButtonItemStyle.Plain, null);
    }
Diver Dan
  • 9,953
  • 22
  • 95
  • 166