Can someone please help me out with this I'm actually going nuts!
What is the best way to get text from a plain .开发者_开发问答txt file into a Scroll View, thats all I need just text.
I've tried so many different solutions but can't get any of them working I was hoping someone could give me a fresh overview.
Is the file a resource in your application or are you loading it from a network resource? If embedded, you can load it into an NSString object and then set the text property of the UITextView with that. Something like:
UITextView *myTextView = [[UITextView alloc] init];
NSString *pathToFile = [[NSBundle mainBundle] pathForResource:@"yourTextFile" ofType:@"txt"];
NSString *theText = [NSString stringWithContentsOfFile:pathToFile encoding:NSUTF8StringEncoding error:nil];
myTextView.text = theText;
精彩评论