Let me try and explain this. Within a project folder has .m and .h files (we all know that haha) however when you start a new “.m” with a xib like for example:
ViewTwoController *loginView = [[ViewTwoController alloc] initWithNibName:@"contentscreen" bundle:nil];
[self presentModalViewController:loginView animated:YES];
[loginView release];
I was wondering how do I create a method that runs as soon as that class (if I can call it that, I’m new to objective C) similar to a main method that Java would have. I want to run some code as soon as that .m has been called and started. Any help would be valued thanks 🙂
To be safe try to put this in
- (void)viewDidLoadEverything that happens here happens when the view is loaded onto the screen.
Note that there are number of places where you can put your method, in
viewWillAppearor in your AppDelegate etc. But I found putting UI elements like your login popup better inviewDidLoadHope this helps…