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

Arne

macrumors regular
Original poster
May 14, 2006
172
0
Germany
Hello,

I am new to Mac OS. I program just for personal uses and because of personal interest. I have been programming in C++ and Java for quite a while now. But Cocoa is (according to Apples decumentations) not supporting Java any more, so I will have to learn Objective-C.

I have gone threw Apples Xcode-tutorial and made the CurrencyConverter work. But now I want to write a simple program and I can't even find out how I get the text from an NSTextField. In Java it is as simple as textfield.getText(); but that doesn't seem to work and I can't find how to do it in the documentation. I guess it is being provided by some class the NSTextField implements but where is it and where can I look such things up?

Thank you for your help and sorry if I just overlooked it.

One more quetion: In NetBeans (and many other IDE's) when I for example type "object." it will give me suggestions of methods I can call (afert I hit the .). Does Xcode have such a feature?

Thanks in advance!

Arne
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
You don't use . for a start. If you have an object that you have linked to a control in Interface Builder you should be able to type "[object " and it will complete a list of possible methods.

To get an NSString from an NSTextField (lets say we have NSTextField *textField) via [textField stringValue];

Edit to add: this is inherited from NSControl. In the documentation each class shows a list of the classes it inherits from making it easy to look this up.
 

whooleytoo

macrumors 604
Aug 2, 2002
6,607
716
Cork, Ireland.
One more quetion: In NetBeans (and many other IDE's) when I for example type "object." it will give me suggestions of methods I can call (afert I hit the .). Does Xcode have such a feature?

Thanks in advance!

Arne

Yup, Xcode has code completion - it can either work automatically or can be invoked manually; and can either work as a pop-up list underneath, or appears 'inline'.

See the Xcode preferences to configure it how you like.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.