Question

I have 2 windows in an xcode project, A and B. A is to capture information, B is to display. I built the windows in IB.

I would like to create a method to control the submit from window A to close window A, and display window B fullscreen.

I am completely new to OBJ C and Cocoa, so Please explain this or provide example code...

If I want to do this, I know I need to create a file from within IB with my A and B to add to my project to add the code, or do I simply add a cocoa file .h and .m to the project. If so, what tells IB that these files correspond to the windows I already created in IB. Once the IBAction is completed I know how to link in IB, but I am at a loss as to how to proceed.

Was it helpful?

Solution

So from what it sounds, you need to declare (in .h):

- (IBAction) closeWindowA:(id)self;

Then tell your application what closeWindowA really does (in. m):

- (IBAction) closeWindowA {

    // your code goes here. Look up method(s) for closing the window - don't know them by heart

}

Then, just connect your Button or whatever is triggering the action in Interface builder using the draggable connections. Hope this helps - I also have to recommend 'Cocoa Programming for Mac OSX' by Aaron Hillegas. Helps tremendously in understanding these kinds of things.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top