简体   繁体   English

如何在xcode 4.2中创建基于菜单的ios应用程序

[英]how to create a menu based ios application in xcode 4.2

I have no idea how to set up a menu based project in xcode 4.2. 我不知道如何在xcode 4.2中设置基于菜单的项目。

Basically, the menu has 4 buttons in it each go to their own Navigation Controlled tableviews, but I'm not sure where to start with xcode 4.2. 基本上,菜单中有4个按钮,每个按钮都有自己的导航控制表视图,但我不知道从哪里开始使用xcode 4.2。

In my previous application I have a main window that has the navigation controller in that, then there is a root view which sets up the 4 buttons and from there the tableview view controllers just get loaded into the navigation controller. 在我以前的应用程序中,我有一个主窗口,其中有导航控制器,然后有一个根视图设置4个按钮,从那里tableview视图控制器刚刚加载到导航控制器。

With xcode 4.2 I cannot seem to set the delegate of the main window, so I cannot figure this out. 使用xcode 4.2我似乎无法设置主窗口的委托,所以我无法弄清楚这一点。

So I am hoping someone understands what I am trying to do and can help me out or send me a example or tutorial or something. 所以我希望有人理解我想做的事情,可以帮助我或给我一个例子或教程或其他东西。 Thanks, any help would be greatly appreciated. 谢谢,任何帮助将不胜感激。

Here is how I setup my navigation controller and root view in the AppDelegate file. 以下是我在AppDelegate文件中设置导航控制器和根视图的方法。 From there you can just add the buttons and so on just as before. 从那里你可以像以前一样添加按钮等。 If you mean to do it with the storyboard, it will be much easier. 如果您的意思是使用故事板,那将更容易。 Let me know if I misunderstood the question though: 如果我误解了这个问题,请告诉我:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.

    [self managedObjectModel];
    [self managedObjectContext];

    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    self.window.backgroundColor = [UIColor whiteColor];

    RootViewController *controller = [[RootViewController alloc] initWithNibName:nil bundle:nil];

    UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:controller];

    [self.window setRootViewController:navigation];
    [controller release];
    [navigation release];
    [self.window makeKeyAndVisible];

    return YES;
}

You'll be fine with one UINavigationController. 你可以使用一个UINavigationController。 In your view with the 4 menu buttons just hide the UINavigationController. 在您的视图中使用4个菜单按钮只需隐藏UINavigationController。

Hide / Show UINavigationController 隐藏/显示UINavigationController

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

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