Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
First post! I have a UITextView that needs to show one line at a time of a txt file loaded from a server. I know how to load the file on the server to the UITextView's text but I don't know how to get it to display one line at a time.
First post! I have a UITextView that needs to show one line at a time of a txt file loaded from a server. I know how to load the file on the server to the UITextView's text but I don't know how to get it to display one line at a time.
Any ideas?
Thanks!
The other poster had the right idea.
Load all the contents of your sever file into an NSString. Let's call it fileText.
That will give you an array, lines, where each element contains a separate line of text ("\n" is the escaped form of a newline).
Then you can loop through the resulting array, adding one line at a time to your text view, using code something like this (assuming "index" is the line number of the text you want to put into your text view) :
Replies
Or change the "," in whatever you put between every line :)
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeLoad all the contents of your sever file into an NSString. Let's call it fileText.
Then use a line like:
That will give you an array, lines, where each element contains a separate line of text ("\n" is the escaped form of a newline).
Then you can loop through the resulting array, adding one line at a time to your text view, using code something like this (assuming "index" is the line number of the text you want to put into your text view) :
Duncan C
WareTo
Animated GIF created with Face Dancer, available for free in the app store.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- (IBAction)loadText:(id)sender {
NSURL *mainURL = [NSURL URLWithString:@\"http://192.168.1.102/text.txt\"];
NSString *mainString = [NSString stringWithContentsOfURL:mainURL];
mainTextView.text = mainString;
}
How would I integrate your code into this?
Thanks again. :)
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome