views:

75

answers:

3

Hi all,

I'm very new to iPhone development so please bear with me. I'm following the tutorial from Apple for creating a "Hello World" application (found here). The problem is (and this is a problem I've had with all tutorials I've attempted to follow) that when I create the application with a subview inside the window, the subview itself is shifted up approximately 20px.

This picture is taken from Apple and shows what the application should look like: Image from Apple example

It looks as it should in the interface builder, but when I run it on the simulator or on a device, it looks like this:

My simulator

Has anybody experienced this before/have any suggestions? I'm not trying to do anything complicated and I have a feeling it's just something simple.

The code for my application:didFinishLaunchingWithOptions method is:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after application launch.

    MyViewController *mvc = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:[NSBundle mainBundle]];
    self.myViewController = mvc;
    [mvc release];

    [window addSubview:[self.myViewController view]];
    [window makeKeyAndVisible];

    return YES;
}

And MyViewController is nothing more than what is created by Xcode when you create the file.

Any thoughts?

Thanks in advance!

Edit Is there a way to simply shift the view down? I'm thinking that maybe the view is the correct size, it's simply shifted up behind the status bar.

Also, just to summarize my comments below, all of my settings are the same as those in the Apple documentation. Additionally, my view is set to 460px high.

A: 

I'm sure it has something to do with the status bar, because the width of the white region at the bottom is the same as the width of the bar.

William Jockusch
Those were my thoughts exactly, but changing some of the status bar settings has no effect and the status bar is visible in both the interface builder and on the iPhone/simulator.
Chris Thompson
A: 

Your view should not be including a status bar. The height of the view should also be set to 460px.

Emil
The status bar is currently set to "grey" and the height is set at 460px. The only options for the status bar are to specify the color.
Chris Thompson
+1  A: 

Check the size of the view -- it should be 320 by 480. Views (obviously) don't have to be full screen, and thus IB makes them resizable with the resize-grip-thing in the lower right corner, which you may have accidentally used.

Jared P
That was it! Thanks!
Chris Thompson