Lefora Free Forum
login join

User Profile

admin actions

Warn | Set Level | Remove [Display email for admins only]

send a private message

holyjaw

None

level: member
rank: rookie
posts: 1
member For: 8 months

Other Forums


admin of 0 forums moderator of 0 forums member of 1 forums
cocoa

Latest Posts

8 months ago

Pure Noob Here with a Pure Noob Question

Hey guys,
So I very recently started learning cocoa and am still grasping at straws with just about everything. I've made a Hello World app following a tutorial

I've got a .xib with a text box and a button, and my code:

HelloWorld.h:

#import <

@interface HelloController : NSObject {
IBOutlet NSTextField *words;
}
- (IBAction)sayHello:(id)sender;
@end

HelloWorld.m:

#import "HelloController.h"

@implementation HelloController
- (IBAction)sayHello:(id)sender{
[words setStringValue:@"Hello, World"];
[words setNeedsDisplay:YES];
}
@end

Pressing the button then updates the text box with "Hello World."

I was very excited when this compiled and ran without a flaw, so I wanted to extend it. Unfortunately this is where I ran in to trouble. I put in a ComboBox that would contain a few phrases. Selecting a phrase would change the text passed to the text box upon pushing the button.

Unfortunately, using the ComboBox apparently requires using NSNotification and NSNotificationCenter... and this is where I get lost. If anyone can help me out, suggest a few lines, explain just how those are used... anything would help me get back on track. Thanks for reading,

HolyJaw