开发者

refreshing contents of UITextView

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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜