开发者

Is there a good component for showing a text log on screen in an iPhone app?

开发者 https://www.devze.com 2022-12-15 22:02 出处:网络
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 lis

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.

0

精彩评论

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

关注公众号