NSAttributedString UITextView崩溃但UILabel工作正常吗?

时间:2016-06-24 10:13:04

标签: swift uitextview ios9 nsattributedstring

我正在使用NSAttributedString并在UITextview上设置它会崩溃但是当我在UILabel上使用NSAttributedString设置此文本时它工作正常。代码如下。它为何与UITextView崩溃?

       let label = UILabel(frame: CGRectMake(0, 0, 400, 400))
       label.center = self.view.center
       label.numberOfLines = 0
       self.view.addSubview(label)
       label.attributedText = appDelegate.attributedText

       let textview= UITextView(frame: CGRectMake(0, 0, 400, 400))
       textview.center = self.view.center
       self.view.addSubview(textview)
       textview.attributedText = appDelegate.attributedText 

0 个答案:

没有答案