展開一個可選值(LLDB)我有一個LoginViewController與viewDidLayoutSubviews()
的功能和作用我有這樣的代碼來創建文本框底部只有邊框內,致命錯誤:意外發現零,而在的UITextField
let txt_border = CALayer()
let txt_pass_border = CALayer()
let border_width = CGFloat(2.0)
txt_border.borderColor = UIColor.grayColor().CGColor
txt_pass_border.borderColor = UIColor.grayColor().CGColor
txt_border.frame = CGRect(x: 0, y: txt_login_Email.frame.size.height - border_width, width: txt_login_Email.frame.size.width, height: txt_login_Email.frame.size.height)
txt_pass_border.frame = CGRect(x: 0, y: txt_login_Password.frame.size.height - border_width, width: txt_login_Password.frame.size.width, height: txt_login_Password.frame.size.height)
txt_border.borderWidth = border_width
txt_pass_border.borderWidth = border_width
txt_login_Email.layer.addSublayer(txt_border)
txt_login_Email.layer.masksToBounds = true
txt_login_Password.layer.addSublayer(txt_pass_border)
txt_login_Password.layer.masksToBounds = true
什麼需要做的改變這個錯誤?
很有可能txt_login_Emai是無 –
對不起,我不明白你 –
你知道什麼是零嗎? –