I'm learning how Objective-C on the iPhone layers views onto the main window.
I've tried remaking a basic program to draw two different colored rectangular views onto the main UIView for an app, but it does not seem to work.
My current output is a white screen. However, when I close the application, it briefly shows the two rectangles as they're closing, making me believe they're drawn but not displayed for some reason.
Assuming the psuedo-code below (shortened from the original documentation for the sake of StackOverflow, but copied directly into my project) is fine, what else might I have to do to my project to get these rectangles to display?
Code from Apple in my TestAppDelegate.m file:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Create the window object and assign it to the
// window instance variable of the application delegate.
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
window.backgroundColor = [UIColor whiteColor];
// Create and initialize a simple red square
// Create and initializesimple blue square
// Add the square views to the window
[window addSubview:redView];
[window addSubview:blueView];
// Once added to the window, release the views to avoid the
// extra retain count on each of them.
[redView release];
[blueView release];
// Show the window.
[window makeKeyAndVisible];
}
Link to Original in Apple Docs: http://tinyurl.com/y8alvgt