Help with objective-c with xcode

Discussion in 'Mac Programming' started by TheCandyMan, Jul 6, 2009.

  1. macrumors newbie

    Jul 6, 2009
    I am quite new to the whole Objective-C thing and pretty much to programming in general. I am currently writing a TicTacToe app. There are two things I need help with as of now and could possibly grow to many more in the future.

    I have the Preferences button in the main menu open up a new window nib name "PreferenceController" and I make a subclass of NSWindowController named "preferenceController" and I want to use a button at the bottom close the window. I really have no idea how to go about doing that. Help would be appreciated.

    I want to make one function call another one. I could go with out this but copy and pasting it nine times just seems like some ugly coding.
  2. macrumors 6502a

    Oct 13, 2007
    You just need to create a method in your controller to handle this and in that method call [self close]. Then you create a button in the interface and wire it up to that method. If any of that does not make sense, then you need to go back and go through whatever Cocoa tutorial you are working through.

    This should be covered in whatever you are using to learn Cocoa. If you are calling Obj-C style methods then it is [self methodname] (or more complicated if there are variables to pass in), or you can use a straight-c method. Either way this should be covered in the tutorials you are working through.
  3. macrumors 6502a


    Oct 26, 2003
    Richmond, VA
    Can you think of any other app that has a "close" button on the bottom of its preferences window? I think you might want to re-think your UI a bit.

Share This Page