R – String Help – Objective C

objective cstringxcode

I'm trying to make an app that will respond to your command when inserted. So you type in any text in the first box and press enter. It will respond with a response in the 2nd field. I'm not sure how the coding is done here. I'm having trouble with the "if inputbox text = @"whatever", I'm pretty sure that is completely off. Here is the code I have so far (not iphone sdk):

#import "HeliosControl.h"

@implementation HeliosControl
- (IBAction)quitButton:(NSButton *)sender {

}

- (IBAction)sendButton:(NSButton *)sender {

    if (inputBox *********)  // <------ What do I put in for the asterisks?
    {
        [outputBox setStringValue:@"Welcome to the SYSTEM"];
    }
    else
    {
        [outputBox setStringValue:@"I do not understand your command."];
    }

}
@end

BTW I'm a complete noob since I started Objective-C like a week ago.

Second Question:

This is a very simple one, but what would be the coding for closing an application? This is for my quit button.

Best Answer

You want if ([[inputBox stringValue] isEqualToString:@"whatever"]) (assuming inputBox is an NSTextField — otherwise, use the appropriate method for that class to get a string out of it).

Oh, and you can quit the application with [NSApp terminate:self].