怎么说“如果按下按钮,那就这样做”目标-c

时间:2017-01-06 20:34:46

标签: objective-c

我希望能够说“按下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);
}

0 个答案:

没有答案