我有一个为iOS7编写的应用程序....
我的AppDelegate中有以下代码
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
// class-level declarations
UIWindow window;
UINavigationController navigationController;
HomeViewController_iPhone homeViewController;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
homeViewController = new HomeViewController_iPhone ();
navigationController = new UINavigationController (homeViewController);
window.RootViewController = navigationController;
window.MakeKeyAndVisible ();
return true;
}
}
此行未通过
navigationController = new UINavigationController (homeViewController);
HomeViewController是一个UINavigationController类......
构建我的代码时收到以下错误 抛出了MonoTouch.Foundation.MonoTouchException。 抛出Objective-C异常。名称NSInvalidArgumentException 原因:不支持推送导航控制器。
有什么想法吗?
答案 0 :(得分:2)
问问自己为什么要在UINavigationController
上创建新的UINavigationController
?
如果您的homeViewController
是UINavigationController
,那么只需执行以下操作:
window.RootViewController = new HomeViewController_iPhone ();
或者您的homeViewController
不应该是导航控制器?