Displaying text in a NSScrollView (Swift)

前端 未结 7 1577
醉酒成梦
醉酒成梦 2020-12-10 05:14

Just started to learn Swift and created a little macOS app in which I want to use a NSScrollView to display an attributed String. I’ve tried:

@I         


        
7条回答
  •  天涯浪人
    2020-12-10 05:50

    It seems that the earlier beta versions (which featured Swift) of Xcode had some serious issues with this kind of outlets (as you can see here: http://swiftwtf.tumblr.com/post/88387419568/nstextview). However, since Xcode 6 Beta 6 it works.

    textFieldOutlet.textStorage.mutableString.setString("Hello w0rld!")
    

    To handle the String, creating an outlet for the textField instead of the scrollView itself is also a better practice.

提交回复
热议问题