Loading
539 views
Noob in need of help!
Page 1
1–1
Hi,
So, I'm a complete noob and I wanted to try out a bit of Cocoa programming but got stuck prety soon.
Here's my problem:
I have this code:
#import "Fusebox.h"
@implementation Fusebox
- (IBAction)calculateAnswer:(id)sender
{
int i;
NSString *q1, *q2;
NSArray *questions;
questions = [NSArray arrayWithObjects: q1, q2, nil];
q1 = @"question1";
q2 = @"question2";
i = (random() % 1) + 1;
[answerField setStringValue: questions objectAtIndex : i];
}
@end
And I have an interface with a text box (linked to the code thing as answerField).
When I call upon this execution it freezes for a second, and then quits out of the interface.
Please can anyone help me with this and how to improve the general coding here.
Thanks in advance,
Ric.
Page 1
1–1