I have a textview which contains chat history obtained from a server.The cha开发者_开发知识库t history is being constantly updated through a thread which I had started in a previous view. My problem is how do I constantly update my UITextView to reflect the changes?
self.textView.text = [[NSString alloc]initWithFormat:@"%@",chatHistory];
I use something like this:
NSString *newMessage = [NSString stringWithFormat:@"%@\n%@", [textView text], newChat];
[textView setText:newMessage];
also make sure your GUI updates are on the main application thread.
[self performSelectorOnMainThread:@selector(updateMyGui) withObject:nil waitUntilDone:NO];
精彩评论