Objective-C tutorial?
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.
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.
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.
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!
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!
Thank you!
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.
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. :/
Quote:(Aside: are you the Willem from C3D forums?)Yep, same guy.
How would I get the value of an NSTextField in Interface Builder from the Obj-C code?
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.
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.
Oh, I misunderstood your question! Sorry bout that... You can do:
NSString *theStringFromMyTextField = [myTextField stringValue];
[myButton setTitle:theStringFromMyTextField];
NSString *theStringFromMyTextField = [myTextField stringValue];
[myButton setTitle:theStringFromMyTextField];
How do I set the name of the text field? In Interface Builder, or in code?
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];
[myTextField setStringValue:@"my title"];
or
[myTextField setStringValue:myString];

