简体   繁体   English

Monotouch.Dialog两个表

[英]Monotouch.Dialog two tables

I'm new to MonoTouch. 我是MonoTouch的新手。 I need to display 2 tables and button between them in 1 view using monotouch.dialog . 我需要使用monotouch.dialog在1个视图中显示2个表和它们之间的按钮。 It should looks like 它看起来应该像

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

I have searched over an internet - But nothing similar to find. 我搜索了一个互联网 - 但没有类似的发现。 :( The problem is to display last strigElement :(问题是显示最后一个strigElement

With MonoTouch.Dialog you can use something like: 使用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"),
            },
        };      
    }

That will use a Section to add an UIButton inside the HeaderView . 这将使用SectionHeaderView内添加UIButton The same trick can be used to add any other kind of control. 可以使用相同的技巧添加任何其他类型的控件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM