2

i have a rtf file, with 2 lines. I want to read it in objective c and every line should be represented in my textView1 and textView2 objects. Is that possible, can you help me please?

4

1 回答 1

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]];
于 2013-05-26T13:31:15.797 回答