Hello, I am new to objective-C and Cocoa. I tried to make an app where you enter text and there is an if statement that decides what happens. Except even if a enter the correct info the else statement still executes. Here is the code:
//This is the header file
#import <Cocoa/Cocoa.h>
@interface Who : NSObject {
IBOutlet id input;
IBOutlet id text;
}
- (IBAction)whoid)sender;
@end
//This is the implementation file
#import "Who.h"
@implementation Who
- (IBAction)whoid)sender {
if (input==@"Tim")
{
[text setStringValue"Hi tim"];
}
else
{
[text setStringValue"I do not know you"];
}
}
@end
//This is the header file
#import <Cocoa/Cocoa.h>
@interface Who : NSObject {
IBOutlet id input;
IBOutlet id text;
}
- (IBAction)whoid)sender;
@end
//This is the implementation file
#import "Who.h"
@implementation Who
- (IBAction)whoid)sender {
if (input==@"Tim")
{
[text setStringValue"Hi tim"];
}
else
{
[text setStringValue"I do not know you"];
}
}
@end