C++ and Cocoa GUI help with Xcode

Discussion in 'Mac Programming' started by begdev, Apr 30, 2009.

  1. begdev macrumors newbie

    Joined:
    Mar 14, 2009
    #1
    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.
     
  2. MrRage macrumors member

    Joined:
    Jun 14, 2008
    #2
    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.

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

Share This Page