我有一个rtf文件,有2行。我想在目标c中阅读它,每一行都应该在我的textView1和textView2对象中表示。这可能吗,你能帮帮我吗?
答案 0 :(得分:2)
NSString* readme = [[NSBundle mainBundle] pathForResource:@"ReadMe" ofType:@"rtf"];
[textView1 readRTFDFromFile:readme];
修改强>
NSString *strFromFile = [NSString stringWithContentsOfFile:@"readMe" encoding:NSASCIIStringEncoding error:null];
NSArray *array = [strFromFile componentsSeparatedByString:@"\n"];
[textView1 setText: [array objectAtIndex:0]];
[textView2 setText: [array objectAtIndex:1]];