一旦我切换到xCode 9,我的UITextView初始化就停止了工作:
@IBOutlet weak var txtPirepText: UITextView!
override func viewDidLoad()
{
if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad
{
self.txtPirepText = UITextView(frame: CGRect(x: 60, y: 380, width: 900, height: 280))
print("IS THIS VALUE NIL? ",self.txtPirepText)
self.txtPirepText.text = ""
self.txtPirepText.font = UIFont(name: "Arial-BoldMT", size: 17)
self.txtPirepText.textColor = UIColor.black
}
}
打印显示值为nil,应用程序在尝试设置文本时崩溃。 这样的初始化不再起作用吗?谢谢!