Xcode 4.2 iOS 空应用程序和故事板 [英] Xcode 4.2 iOS Empty Application and storyboards

查看:32
本文介绍了Xcode 4.2 iOS 空应用程序和故事板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Xcode 新手,我正在尝试制作我的第一个培训应用程序.因为显然空应用程序模板是唯一提供预集成核心数据的模板,所以我选择了它.但是,在那之后,我无法让 UI 工作(它仍然是空的).

I'm an Xcode newbie, and I'm trying to make my first training app. Since apparently Empty Application template is the only template that offers pre-integrated Core Data, I choose that. However, after that, I can't get UI to work (it remains empty).

我做了什么:

  • 空应用程序模板
  • 新的 iPad 故事板文件
  • 将标签栏控制器溅到上面
  • 更改了项目摘要视图中的主要故事板
  • 点击⌘R
  • 盯着纯白色的 iPad 屏幕,没有任何标签

我尝试对比我创建为标签栏应用程序的另一个项目(它确实反映了我的情节提要更改),但没有任何见解.

I tried diffing against another project that I created as a Tab Bar Application (which does reflect my Storyboard changes), without any insight.

推荐答案

注释掉(或删除)AppDelegate.m中的窗口创建和显示代码如下:

Comment out (or remove) the window creation and display code in AppDelegate.m as follows:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    // self.window.backgroundColor = [UIColor whiteColor];
    // [self.window makeKeyAndVisible];

    return YES;
}

使用情节提要时,会自动为您创建一个主 UIWindow.您的情况是,您正在创建另一个白色窗口并将其放在选项卡 UI 的顶部.

When using a storyboard, a main UIWindow is created for you automatically. What is happening in your case is that you are creating another white window and putting it over the top of the tab UI.

ALSO - 请注意,主/明细模板还为您提供了核心数据选项.

ALSO - note that the Master/Detail template also gives you a core data option.

这篇关于Xcode 4.2 iOS 空应用程序和故事板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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