Generating a view programmatically in iOS


Thanks for all the tips, everyone. The tutorial mentions that a XIB file is provided (which I don't have) so I'm doing something wrong in how I'm creating the the project.

I am following Apple's Core Data Tutorial for iOS. This tutorial has not been updated for ARC—apparently for Xcode 4, since it asks to "create a new project using the Window-Based Application template in the iOS section."

Since that option doesn't exist under Xcode 4.4.1, I looked around Stack Overflow and read that I should create an empty application. As per the tutorial instructions, I created no Storyboard or NIB file.

Other than updating the code for ARC (using strong in place of retain and not implementing the provided dealloc method), I'm confident that the code in my project matches that of the tutorial up to the end of the chapter "The Table View Controller." At this point, the tutorial says I should be able to run the project and get a view.

Instead, I get a blank, black screen.

Maybe my problem is too vague to solve here, but should I perhaps be using a different project template? Which one?

I have only two classes: a RootViewController and an AppDelegate. AppDelegate imports RootViewController and contains a UIWindow property. Again, there is no Storyboard or NIB in the project.

I can provide any code too if there's someplace specific to look.


If you want to check if your setup is correct do the following:

  1. add a background color to your window

    self.window.backgroundColor = [UIColor whiteColor];

  2. make sure you tell the window to display itself

    [self.window makeKeyAndVisible];

  3. make sure your view controller is the window's rootViewController

    self.window.rootViewController = myViewControllerInstance;

Choose Single View Application, and uncheck 'Use storyboards" field. The rest should go the same.

Need Your Help

How do I record a click to change the content on the next page with javascript

javascript jquery html

I don't know php or any backend type of code. I don't know if I'm asking this properly, apologies if I'm not, but what I want to happen is:

Web game concurrency control

php database web-applications concurrency

There are some other SO questions about concurrency but they don't quite address my scenario.