2011-11-28 48 views
1

我是新來的MonoTouch。 我需要在1個視圖中使用monotouch.dialog在它們之間顯示2個表格和按鈕。 它應該看起來像Monotouch.Dialog兩張表

---top of screen--- 
I BoolElement  I 
I StringElement I 
I StringElement I   <--- Yeah,yeah this is iPhone(in my Opinion) 
I --empty space-- I 
I button   I 
I --empty space-- I 
I StringElement I 
---End Of screen-- 

找遍了互聯網 - 但沒有類似發現。 :( 問題是要顯示上次strigElement

+2

Off-Topic:Nice ASCII-Phone,我可以在哪裏購買它? –

+0

致電Aplle,詢問iPhone 5;) –

回答

3

隨着MonoTouch.Dialog您可以使用類似:

RootElement CreateRoot() 
    { 
     var btn = new UIButton(); 
     btn.TouchUpInside += delegate { 
      Console.WriteLine ("touch'ed"); 
     }; 
     // TODO: customize button look to your liking 
     // otherwise it will look like a text label 
     btn.SetTitle ("button", UIControlState.Normal); 
     Section s = new Section(); 
     s.HeaderView = btn; 
     return new RootElement (String.Empty) { 
      new Section() { 
       new BooleanElement ("bool", false), 
       new StringElement ("s1"), 
       new StringElement ("s2"), 
       }, 
      new Section(), 
      s, 
      new Section() { 
       new StringElement ("s3"), 
      }, 
     };  
    } 

將使用一個Section添加一個UIButtonHeaderView內相同的技巧可以使用添加任何其他類型的控件。

+0

謝謝,它幫助:) –