我希望能够说“按下nextButton时输出”。我也有按钮的IBAction,我不知道该怎么办。
NSURL *myURL = [[NSBundle mainBundle]
URLForResource: @"artList" withExtension:@"txt"];
NSError *error = nil;
NSString *string = [NSString stringWithContentsOfURL:myURL encoding:NSUTF8StringEncoding error:&error];
if (string) {
NSArray *lines = [string componentsSeparatedByString:@"\n"];
//output first definition to screen
_wordDefBox.text = [NSString stringWithFormat:@"%@%@",_wordDefBox.text, lines[0]];
_wordDefBox.text = [NSString stringWithFormat:@"%@%s",_wordDefBox.text, "\n"];
_wordDefBox.text = [NSString stringWithFormat:@"%@%@",_wordDefBox.text, lines[1]];
}
//error checking
else {
NSLog(@"Unable to load string from %@: %@", myURL, error);
}