开发者

Printing out Log style in Xcode interface builder

开发者 https://www.devze.com 2023-03-29 15:26 出处:网络
This really shouldn\'t be this hard but I\'m stumped.I just want to do something simple like write o开发者_StackOverflow社区ut a log type area in my app.Here is the problem, if I use NSTextField then

This really shouldn't be this hard but I'm stumped. I just want to do something simple like write o开发者_StackOverflow社区ut a log type area in my app. Here is the problem, if I use NSTextField then the message gets overwritten, and if I use NSTextView I try and lock the edit feature with "setEditable" but this seems to lock up the app. I get too many messages and it doesn't write out everything fast enough as the threads.

Pretty much what I want to reproduce is a scrolling log which the user can see, like console and using NSLog. What should I be using?

Thanks for any help.


Writing text means there's drawing code. Drawing is expensive and can tie up your main thread, so you may want to try dedicating a thread/nsoperation to appending an outputString and setting a textView's textValue to the outputString. This way, the thread that you are now running on doesn't get tied up with the drawing code.

0

精彩评论

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

关注公众号