第一个mac应用程序 - 推视图控制器 [英] first mac app - push viewcontroller

查看:330
本文介绍了第一个mac应用程序 - 推视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我做一些iphone应用程序,现在我想做一个mac应用程序。

I have a question, I do some iphone application and now I want to do a little mac application.

从一个干净的应用程序,我添加一个按钮在MainMenu xib ,比我添加一个NSViewController到MainMenu(从IB)与一个Action。
我创建一个新的NSViewController(FirstViewController)与一个nib文件和一个按钮。
现在我只想创建一个从MainMenu推送FirstController的函数和一个从FirstController推送MainMenu的简单函数。

From a clean application I add a button on MainMenu xib, than I add a NSViewController to MainMenu (from IB) with one Action. I create a new NSViewController (FirstViewController) with a nib file and a button. Now I want only to create a function to push FirstController from MainMenu and a simple function to push MainMenu from FirstController.

这样的东西

ViewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController: ViewController animated:YES];

我如何做?

推荐答案

我想你想为MacOS X带来一个iOS风格的界面,这在许多情况下不会工作。 MacOS X用户界面与iOS非常不同。

I think you're trying to bring an iOS-style interface to MacOS X, and that won't work in many cases. The MacOS X user interface is very different from that of iOS.

iOS应用程序仅限于一个(通常是小的)窗口,用户通常在一个时间。导航界面标准化了用户向下钻取任务的不同部分的方式,以便旅程是可预测的。界面是非常模态的,因为用户不断地在应用程序的不同部分之间导航,用户操作通常链接到活动的应用程序的部分。

iOS apps are limited to a single (and often small) window, and users generally do one thing at a time. The navigation interface standardizes the way that users drill down through different parts of a task so that the journey is predictable. The interface is very modal in the sense that the user is constantly navigating between different parts of the app, and user actions are often linked to the part of the app that's active.

另一方面,桌面具有大量的屏幕空间并允许多个窗口。桌面应用应为无模式 - 用户不通过应用程序导航,但看到整个事情摆在他或她之前。用户应该可以随时执行任何操作。

The desktop, on the other hand, has plenty of screen space and allows multiple windows. Desktop apps should be modeless -- a user doesn't navigate through the app, but sees the whole thing laid out before him or her. As much as possible, the user should be able to perform any action at any time.

由于这些原因,Cocoa中没有与Cocoa Touch的UINavigationController类似的导航控制器。如果您可以告诉我们您的两个视图控制器管理的任务更多,或许有人在这里可以帮助您想办法更好地翻译到预期的桌面体验。

For these reasons, there is no navigation controller in Cocoa similar to Cocoa Touch's UINavigationController. If you can tell us more about the tasks that your two view controllers manage, perhaps someone here will help you think of ways to translate that better to the expected desktop experience.

这篇关于第一个mac应用程序 - 推视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆