带有 TTSplitViewController 的空白窗口

发布于 2024-11-18 08:03:47 字数 1216 浏览 1 评论 0原文

我遵循与 TTSplitViewController 的 TTCatalog 示例相同的代码,从应用程序委托代码、TTSplitViewController 代码以及 TTTableViewController 的代码开始。但是,当我运行应用程序时,我看到的是空白屏幕。

我从基于窗口的应用程序开始并删除了 nib 文件,因为 TTCatalog 上的示例没有它。

我在这里做错了什么?

这是一些代码,在我的应用程序委托 didFinishLaunchedWithOptions 中,我有:

TTNavigator* navigator = [TTNavigator navigator];
    navigator.supportsShakeToReload = YES;
    navigator.persistenceMode = TTNavigatorPersistenceModeAll;

    TTURLMap* map = navigator.URLMap;
    [map from:@"*" toViewController:[TTWebController class]];


    if (TTIsPad()) {
        [map                    from: @"tt://catalog"
              toSharedViewController: [SplitViewController class]];

        SplitViewController* controller =
        (SplitViewController*)[[TTNavigator navigator] viewControllerForURL:@"tt://catalog"];
        TTDASSERT([controller isKindOfClass:[SplitViewController class]]);
        map = controller.rightNavigator.URLMap;

    }  

其他所有内容都与 TTCatalog 示例类似。

我只是想知道是否有人可以指导我如何创建 TTSplitViewController 应用程序,因为这非常令人沮丧。 TTCatalog 上的示例看起来很简单,但是在复制它时,一切都失败了。

如需完整代码,可以在此处下载

I followed the same exact code as the TTCatalog example of TTSplitViewController, starting from the app delegate code, the TTSplitViewController code, and as well as the code for the TTTableViewController. However, when I run the apps I am getting a blank screen.

I started from a window based application and removed the nib file, as the example on TTCatalog doesn't have it.

What am I doing wrong here?

Here's some code, in my app delegate didFinishLaunchedWithOptions I have:

TTNavigator* navigator = [TTNavigator navigator];
    navigator.supportsShakeToReload = YES;
    navigator.persistenceMode = TTNavigatorPersistenceModeAll;

    TTURLMap* map = navigator.URLMap;
    [map from:@"*" toViewController:[TTWebController class]];


    if (TTIsPad()) {
        [map                    from: @"tt://catalog"
              toSharedViewController: [SplitViewController class]];

        SplitViewController* controller =
        (SplitViewController*)[[TTNavigator navigator] viewControllerForURL:@"tt://catalog"];
        TTDASSERT([controller isKindOfClass:[SplitViewController class]]);
        map = controller.rightNavigator.URLMap;

    }  

and everything else is similar to the TTCatalog example.

I was just wondering if anyone can give me a pointer on how to create a TTSplitViewController app, as this is quite frustrating. The example on the TTCatalog seems so simple, but when replicating it, everything fails.

For a full code, can be downloaded here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

还不是爱你 2024-11-25 08:03:47

如果您使用 xcode 模板创建项目,则意味着您的应用程序委托是使用 nib 文件加载的。您必须更改它,因为 Three20 根本不使用 nib 文件。

打开 main.m 文件,然后更改:

int retVal = UIApplicationMain(argc, argv, nil, nil);

(将

int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");

@"AppDelegate" 替换为您的 UIApplicationDelegate 类名。这应该将您的主窗口加载到设备中。

另请注意,TTSplitViewController 类有点错误。我必须修改一些在 Three20 中编写代码以使其正常工作,请参阅 https://github.com/aporat/ Three20-splitview-example 如果您想尝试我的 TTSplitViewController 版本。

If you created a project using a xcode template, it means your app delegate is loaded using a nib file. You will have to change it, because Three20 doesn't use nib files at all.

open the main.m file, and change:

int retVal = UIApplicationMain(argc, argv, nil, nil);

to

int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");

(Replace @"AppDelegate" with your UIApplicationDelegate class name. That should load your main window into the device.

Also note, that the TTSplitViewController class is a little buggy. I had to modify some code in three20 to make it work as it should. see https://github.com/aporat/three20-splitview-example if you want to try my version of TTSplitViewController.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文