【问题标题】:Search view using MonoTouch.Dialog使用 MonoTouch.Dialog 搜索视图
【发布时间】:2012-02-14 20:46:58
【问题描述】:

我是MonoTouchMonoTouch.Dialog 的新手。使用 Elements API,我创建了一个包含两个按钮“帐户”和“联系人”的简单视图。

public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
    _window = new UIWindow(UIScreen.MainScreen.Bounds);

    _rootElement = new RootElement("Sample")
    { 
        new Section()
        {
            new StringElement ("Accounts", delegate { ElementTapped(); }),
        },
        new Section()
        {
            new StringElement ("Contacts", delegate { ElementTapped(); }),
        }
    };

    _rootVC = new DialogViewController(_rootElement);
    _nav = new UINavigationController(_rootVC);
    _window.RootViewController = _nav;

    _window.MakeKeyAndVisible ();

    return true;
}

点击任一按钮后,我想调出一个新视图进行搜索。我知道我必须创建一个新的DialogViewController 并将EnableSearch 设置为true,但是如何从delegate 中将其添加到我的NavigationController

谢谢。

【问题讨论】:

    标签: xamarin.ios monotouch.dialog


    【解决方案1】:

    对于“Accounts”和“Contacts”,使用您已配置的新“RootElement”来按需创建嵌套的 DialogViewController:

     new RootElement ("Accounts", x => {
         return new DialogViewController (....) {
              EnableSearch = true
         }
     }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-03-13
      • 1970-01-01
      • 1970-01-01
      • 2018-08-14
      • 2012-07-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多