Is there a good component for showing a text log on screen in an iPhone app?
I want to have a screen in my app that shows real-time log information - e.g. a scrolling list of textual strings. Previously I've seen people just use a textview and append new log entries to the list开发者_运维知识库 - it seems this may be not so efficient, especially when the list becomes long. Is there any sample code out there that can efficiently show real-time text log information? Or does everyone just write their own using a tableview?
Thanks
UITableView would be the way to go here, and using the deque
idea Alex mentioned above, just call insertRowsAtIndexPaths:withRowAnimation:
and deleteRowsAtIndexPaths:withRowAnimation:
as you push/pop log entries onto your deque.
If you're building your own, perhaps you could use a deque of UITextView
instances, adding to the end of the queue and removing from the front, only buffering a constant number of instances.
You could perhaps feed the deque to a UIView
that contains the text views as subviews, with various offsets set based on how many lines your application is displaying at one time.
精彩评论