tags:

views:

587

answers:

3

I can't find it. Actually I look for the part where I could try this:

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
self.navigationController.view.bounds = CGRectMake(0,0,320,480);
self.navigationController.navigationBar.hidden = YES;
+6  A: 

The starting point would be your App delegate, the applicationDidFinishLaunching method. When you create a new application, x-code should create one of those for you.

- (void)applicationDidFinishLaunching:(UIApplication *)application {    
    // Do your thing here.
}
Eric Petroelje
ok I got that file :) but where can I add the code above to do those changes to the UIApplication object?
Thanks
applicationDidFinishLaunching - just edited my answer to put the function signature in there. You would need to create an outlet on that class for the navigationController and wire them up though (if you haven't already done that).
Eric Petroelje
+2  A: 

As the other answer says, applicationDidFinishLaunching is a good touchdown spot for the app itself. But, if you'd like to do things from within the scope of the view controller (or navigation controller, as the case may be), you'll want to go into the controller's implementation file (a .m file) and look for viewDidLoad.

- (void)viewDidLoad {
   [super viewDidLoad];
   // go nuts
}
sandover
thanks. Where can I find that controller implementation file? What's it's name? In my project there's just one file that contains the word "controller". I guess you mean this one, where I must override -(void)viewDidLoad?
Thanks
+1  A: 

When your RootViewController is hooked up to the main window in a NIB file, the RootViewController's viewDidLoad method actually gets called before the ApplicationDelegate's applicationDidFinishLaunching: method. (At least this is my experience.)

This is problematic if you want to set up defaults or do other work before the RootViewController even starts loading its content.

The solution is to override -(void)awakeFromNib in the ApplicationDelegate. This is the earliest entry point I know of in NIB-based apps (except for the ApplicationDelegate's +init method).

This is a good reference: http://cocoawithlove.com/2008/03/cocoa-application-startup.html

Felixyz