Re: Newbie pulling my hair out regarding a simple xcode issue. Please help :-)
Re: Newbie pulling my hair out regarding a simple xcode issue. Please help :-)
- Subject: Re: Newbie pulling my hair out regarding a simple xcode issue. Please help :-)
- From: "Hank Heijink (Mailinglists)" <email@hidden>
- Date: Mon, 23 Jun 2008 07:49:55 -0700
You might want to have a look at Aaron Hillegass' (I hope I spelled
that right) book. I think you'll be able to do what you want after
having read that. Also, you might want to post to cocoa-dev, not the
Xcode users list for questions like this.
One way to do this is with three outlets in a custom class
(AppController or some such name seems a good one). I'm typing this in
Mail, so no error-checking here...
IBOutlet NSTextfield *firstNameField;
IBOutlet NSTextfield *lastNameField;
IBOutlet NSTextfield *peoplesNamesField;
Then, have an action method:
- (IBAction)addName:(id)sender;
In IB, you just wire up the outlets and the action method to your
class, and you're done.
In the action method, read the contents of the first- and lastName
fields, concatenate them, and add them to the string in
peoplesNamesField. You only need to keep an array of the names if you
need the individual names afterwards (in fact, you probably do). In
that case, you might actually prefer an NSTableView over a multiline
text field.
Hope this helps,
Hank
On Jun 23, 2008, at 5:10 AM, Papa-Raboon wrote:
Hi All,
I have been trying to get my hair around Cocoa programming and have
worked through many a tutorial and it seems to be coming to me slowly.
I wondered if anyone could help me figure out a simple exercise that I
came up with myself to make it clearer how to properly address objects
with each other.
I have a simple interface in interface builder that has two text
fields (NSTextField) and a multi-line NSTextField and a button.
The two text fields are "firstName" & "lastName". The multi-line text
field is "peoplesNames" The push button is "addName".
All I need this to do is allow me to type a first name, last name,
press a button and the name gets added to the multiline text field.
Only issue is I cannot get my head around what connects to what in
Interface Builder.
I guess I need to concatenate the two name fields into a single
NSMutableString (with a space in the middle) then add them to an
NSMutableArray which is looped through to display in the multiline
text field.
This would be an insignificant task for an experienced Cocoa
programmer but would teach newbies like me a thing or two.
Many of the tutorials seem to be far too simple. And others too
complicated. Where's the intermediate ones like this.
Could anyone please help in some way either with a description of what
needs to be done or a link to a similar tutorial.
Cheers
Paul
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden