我刚刚更新到最新版本的 Swift,我遇到了断点错误的问题。控制台中没有错误。
backgroundsetting.innerColor = UIColor.rgb(fromHex: 0xB0E7D7)
backgroundsetting.outterColor = UIColor.rgb(fromHex: 0x005E7D)
backgroundsetting.frame = (frame: CGRect(x: self.view.frame.size.width * 0, y: self.view.frame.size.height * 0, width:self.view.frame.size.width, height: self.view.frame.size.height))
self.view.addSubview(backgroundsetting)
然后在更新后它希望我设置backgroundsetting.frame as! CGRect
它,当我打开应用程序的那部分时它会崩溃应用程序。为什么会出现这种情况?这是后面的代码:
backgroundsetting.innerColor = UIColor.rgb(fromHex: 0xB0E7D7)
backgroundsetting.outterColor = UIColor.rgb(fromHex: 0x005E7D)
backgroundsetting.frame = (frame: CGRect(x: self.view.frame.size.width * 0, y: self.view.frame.size.height * 0, width:self.view.frame.size.width, height: self.view.frame.size.height)) as! CGRect
self.view.addSubview(backgroundsetting)