PDA

View Full Version : C++ and Cocoa GUI help with Xcode




begdev
Apr 30, 2009, 05:25 PM
If I'm writing an application in C++ and using Cocoa, how exactly would I link checkboxes/text inputs/button clicks to my C++ code in Xcode?

I've only ever created command line applications, so I'm not sure about connecting it to a GUI.

Should I just use Objective-C?

Any help is appreciated, thanks.



MrRage
Apr 30, 2009, 05:46 PM
You would use Objective C and it would talk to your C++ code.

In a nut shell: make a nib, layout your controls, add IBActions to your ObjC controller class and use the linked method to invoke your C++ function.


- (void)buttonClick:(id)sender {
MyClass->func();
}