Connecting an Application Delegate to a Controller Class

I am stuck at this stage of XCode application development:

What I'm confused about is the role of the AppDelegate class, created by default when the project is created natively in Xcode 4. If I am implementing a custom controller, let's use the above example and call it TrackController. Am I making this controller an application delegate? It seems that any tutorial I have read is not very clear.

So, in AppDelegate, am I creating a new instance of the controller class here? And if so, then will I connect the output? Or can I change the owner of the file as a controller class? If so, how do you do it in XCode 4?

Not a very clear question that I know, but I'm sure someone knows what I'm talking about.


The following screenshot shows what I mean. Now the blue box is "Track Controller". In this case, I showed the AppDelegate class, but to be clear. Which am I using, AppDelegate.m or TrackController.m? How to do it?

enter image description here


Coming back to this, I have uploaded the code to GitHub here as I still haven't figured out how to connect everything,

To clarify, I need to figure out how AppDelegate and TrackController relate to each other and interact with each other. The concepts are generally new to me and I've read Apple's documentation but they didn't help me. I've even had in-depth discussions with experts and still don't understand how this is supposed to work.

My model is a track, then I have a TrackController and of course the AppDelegate. The AppDelegate creates an instance of the TrackController and I was hoping it could open its window.

What am I doing wrong? Hope an expert can help me!


source to share

1 answer

What it describes is that the application delegate should focus on handling the calls to delegates sent to the application.

In fact, you create a new class that will act as the main controller of the application, and then you add code to call it when the application has finished loading. From there, this application is (presumably) your main checkpoint (except, of course, when it breaks away from another class).

I'm more familiar with how the process works on iOS than with Macs that have to worry about Windows, but for an iOS app, you have to add code to invoke your view control from within ApplicationDidFinishLaunching: WithOptions :. From there, the controller opens, and the easiest way to view the entire process is that you start with a view controller (which is how most tutorials handle it, in fact, letting Xcode handle the fact that the application delegate is creating this view controller).



All Articles