Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
318 views
in Technique[技术] by (71.8m points)

Xcode 4.2 iOS Empty Application and storyboards

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).

What I did:

  • Empty Application template
  • New iPad Storyboard file
  • Splashed Tab Bar Controller onto it
  • Changed Main Storyboard in Project's Summary view
  • Hit ?R
  • Stared at pure-white iPad screen, without any tabs

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

question from:https://stackoverflow.com/questions/7906541/xcode-4-2-ios-empty-application-and-storyboards

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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;
}

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 - note that the Master/Detail template also gives you a core data option.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...