2012-02-14 101 views
1

我是MonoTouch的新手,因此MonoTouch.Dialog。使用Elements API,我创建了一个带有两个按钮“帐户”和“联系人”的简单视图。使用MonoTouch.Dialog搜索视图

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

谢谢。

回答

1

对于“帐户”和“联系人”使用新的“rootElement的”您已经配置按需创建嵌套DialogViewController:

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

完美,谢谢。 – dewed 2012-02-15 22:53:58