Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

TheCandyMan

macrumors newbie
Original poster
Jul 6, 2009
1
0
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.

#1
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.

#2
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.
 

larkost

macrumors 6502a
Oct 13, 2007
534
1

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.