Monday, July 2, 2012

How to understand Xcode from beginning for View Base Application for newbie?

Since I am a noob, after spending many hours looking at the code, finally i have some simple idea how it all started

when you first create a project, you will notice there are 4 file

AppDelegate.h
AppDelegate.m
ViewController.h
ViewController.m

let me explain using noob way, the whole process start from AppDelegate.m


- (void) applicationDidFinishLaunching:(UIApplication*)application
{

This method mean: WHEN YOUR APP FINISH LAUNCHING, WHAT SHOULD YOU DO NEXT

normally we will put your viewController here to tell the app to launch it with your view

// make the OpenGLView a child of the view controller
[viewController setView:glView];
// make the View Controller a child of the main window
[window addSubview: viewController.view];

Then you will be asking, what the hell is the "viewController" and "window"?

well actually both is an object that you declared on the AppDelegate.h

UIWindow *window;
RootViewController *viewController;

Then you will ask what is the UIWindow???

-The window is the root view in the view hierarchy

-It is the window to show to view

Then what is the ViewController???

-It is the area where you control everything, all the timer and action and graphics and stuff

I guess I can only help so much since I am a noob myself, but keep learning, one day you will become god of programming








No comments:

Post a Comment