2
我得到了一個自定義UIView,我加載我的ViewController。添加約束崩潰應用程序
func loadBottomSheet(){
bottomSheet = Bundle.main.loadNibNamed("BottomSheetTest", owner: self, options: nil)![0] as! BottomSheetTest
bottomSheet?.setUp(parentController: self)
bottomSheet?.tag = 9009164
self.view.addSubview(bottomSheet!)
}
自定義視圖中的代碼如下:
func setUp(parentController: UIViewController){
self.parentController = parentController;
self.translatesAutoresizingMaskIntoConstraints = false
self.leftAnchor.constraint(equalTo: parentController.view.leftAnchor).isActive = true
self.rightAnchor.constraint(equalTo: parentController.view.rightAnchor).isActive = true
self.heightAnchor.constraint(equalToConstant: CGFloat(400)).isActive = true
self.bottomAnchor.constraint(equalTo: parentController.view.bottomAnchor).isActive = true
}
我試着將它添加到我的視圖控制器。以下代碼使用一般性錯誤崩潰應用程序:libC++ abi.dylib:以NSException類型的未捕獲異常終止。
在這一點上,我已經從自定義視圖中刪除了一切。你在這裏看到的只是它,沒有更多的UI元素,沒有IBOutlets,就是這樣。我在智慧的結尾。
這工作..馬上回來,自殺。 –