0

我有一个单点触控对话框视图控制器。我有许多嵌套的根元素

        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;
        }

我的问题是每个元素标题的长度。我的顶级根标题也很长,例如 Welcome to my application

如果我点击后退按钮上方的根元素,则会显示“欢迎使用....”,理想情况下,我希望按钮显示“后退”而不是长字符串。

有可能更新这个吗?

4

1 回答 1

1

好的解决了。如果其他人有同样的问题,这对我有用。

最后一行是诀窍。

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);
    }
于 2013-06-18T10:31:11.953 回答