Last end of my wits! Help! (XCODE OSX, basic app nightmare)
Hi Folks,
I literally spent an entire night trying to solve this...scoured the net/read tons of cryptic
articles. I really am on my last braincell here and would appreciate if someone can help me.
I am trying to create a simple app in OSX where I click on a thumbnail size picture
and a random bit of text will appear.
The Interface is a simple window with a simple picture, text label. I associated everything
via the delegate...yet the code keeps giving me this error message. I read that the 'string'
needs to be modified (and this is where I start losing my hair)
Below is the code I wrote:
The Header:
#import <Cocoa/Cocoa.h>
@interface AppAppDelegate : NSObject <NSApplicationDelegate> {
@private
NSTextField *textoutput;
}
- (IBAction)button2:(id)sender;
@property (assign) IBOutletNSTextField *textoutput;
@end
And the Implement:
#import "AppAppDelegate.h"
@implementation AppAppDelegate;
@synthesize textoutput;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
int randomnumber = arc4random() % 3+1;
- (IBAction)button2:(id)sender {
switch ([sender randomnumber]) {
case 1:
textoutput.text = @"Test1";
break;
case 2:
textoutput.text = @"Test2";
break;
case 3:
textoutput.text = @"Test3";
break;
case 4:
textoutput.text = @"Test4";
break;
default break;
}
}
}
@end
Highlighted in red: I keep getting a "Expected Expression" error or some other cryptic error message.
I would greatly appreciate any help/advice/corrections! Someone helped me before with a simple 'dice' game
and that help helped me beyond all comprehension in basic coding...I now want to figure out the User Interface!!!
Thanks