Monotouch.Dialog two tables

别说谁变了你拦得住时间么 提交于 2019-12-23 03:02:13

问题


I'm new to MonoTouch. I need to display 2 tables and button between them in 1 view using monotouch.dialog. 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


回答1:


With MonoTouch.Dialog you can use something like:

    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. The same trick can be used to add any other kind of control.



来源:https://stackoverflow.com/questions/8296548/monotouch-dialog-two-tables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!