2013-06-18 55 views
0

我有一個單擊對話框視圖控制器。我有一些嵌套的根元素更新對話框視圖控制器中的BackButton文本

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

我的問題是每個元素標題的長度。我的頂級根標題也很長,例如歡迎來到我的應用程序

如果我點擊後面的按鈕上方的rootelement顯示「welcome to ....」,理想情況下我希望按鈕顯示「back」與長字符串。

是否有可能更新?

回答

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); 
    } 
相關問題