iDevGames Forums
Objective-C tutorial? - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Tools & Technology (/forum-10.html)
+--- Thread: Objective-C tutorial? (/thread-2479.html)

Pages: 1 2 3 4


Objective-C tutorial? - computergeek6 - Aug 6, 2008 10:35 PM

I'm trying to figure out Objective-C and Cocoa, but I'm getting confused. Is there a good tutorial for migrating from C to Objective-C and Cocoa? If not, please recommend a learning path.


Objective-C tutorial? - AnotherJake - Aug 6, 2008 11:05 PM

I was gonna say search the forums, but even Google gave me junk for some reason. I guess I didn't figure out the magic werdz this time...

You'll want to purchase a copy of: Cocoa Programming for Mac OS X by Aaron Hillegass.

You will also want to read Apple's docs on getting started with objective-c and Cocoa.

There are a bunch of other places which I'm sure others will be quick to recommend, but those are the top two.


Objective-C tutorial? - Man With No Name - Aug 7, 2008 06:06 AM

If you want to learn about the Objective-C language itself, I highly suggest Programming in Objective-C.

You might take a look over at CocoaLab and their BecomeAnXcoder online book, I found that to be helpful.

And last but not least, check out CocoaDev, it's a very comprehensive wiki for Cocoa. If I can't figure something out from the documentation, that site is the first thing I check for information.

Hope that helps!


Objective-C tutorial? - computergeek6 - Aug 7, 2008 08:14 PM

Thank you!


Objective-C tutorial? - Willem - Aug 9, 2008 02:56 AM

Quote:You'll want to purchase a copy of: Cocoa Programming for Mac OS X by Aaron Hillegass.
I'll second this. That book is excellent and it made everything very clear to me coming from a C++/MFC background.


Objective-C tutorial? - FlamingHairball - Aug 9, 2008 07:59 AM

(Aside: are you the Willem from C3D forums?)


Objective-C tutorial? - Fenris - Aug 9, 2008 09:02 AM

Thirding Hillegass' book. Make sure you actually buy it, it's one of the cornerstones of the community's adoption of Cocoa, and I heard something about it not selling well due to PDF piracy. :/


Objective-C tutorial? - FlamingHairball - Aug 9, 2008 09:11 AM

Its a REALLY good book.


Objective-C tutorial? - Willem - Aug 9, 2008 10:08 AM

Quote:(Aside: are you the Willem from C3D forums?)
Yep, same guy.


Objective-C tutorial? - computergeek6 - Aug 9, 2008 02:31 PM

How would I get the value of an NSTextField in Interface Builder from the Obj-C code?


Objective-C tutorial? - AnotherJake - Aug 9, 2008 02:35 PM

computergeek6 Wrote:How would I get the value of an NSTextField in Interface Builder from the Obj-C code?

The interface (what you make in InterfaceBuilder) doesn't "get" a value from your Obj-C code, it gets "set" by your Obj-C code.


Objective-C tutorial? - computergeek6 - Aug 9, 2008 02:43 PM

I know, but I can't figure out how to store the text from my NSTextField into an NSString. I have a button and a text-field in a window, the user has to put something in the field, then click the button, then the button sends an event to the instance of my class, then the class needs to get the text in the text field, and set the caption of the button to whatever is in the text field.


Objective-C tutorial? - AnotherJake - Aug 9, 2008 02:52 PM

Oh, I misunderstood your question! Sorry bout that... You can do:

NSString *theStringFromMyTextField = [myTextField stringValue];
[myButton setTitle:theStringFromMyTextField];


Objective-C tutorial? - computergeek6 - Aug 9, 2008 02:53 PM

How do I set the name of the text field? In Interface Builder, or in code?


Objective-C tutorial? - AnotherJake - Aug 9, 2008 03:01 PM

Not exactly sure what you mean by "name". If you mean the text field's contents, you can do it from either IB or code:

[myTextField setStringValue:@"my title"];

or

[myTextField setStringValue:myString];