【发布时间】:2018-03-18 07:46:15
【问题描述】:
您好,我尝试在名为 typeDeProbleme 的文本字段中添加 UIImageView。一切正常,没有显示错误,除非我尝试单击 typeDeProbleme,XCode 在目标输出中给了我这个:
[未知进程名称] CGContextSetFillColorWithColor: 无效上下文 0x0。如果要查看回溯,请设置 CG_CONTEXT_SHOW_BACKTRACE 环境变量。
let imageView = UIImageView()
let image = UIImage(named: "arrow")
imageView.image = image
imageView.frame = CGRect(x: 0, y: 0, width: 25, height: 15)
imageView.contentMode = .scaleAspectFit
typeDeProbleme.rightViewMode = UITextFieldViewMode.always
typeDeProbleme.rightView = imageView
typeDeProbleme.addSubview(imageView)
我已经尝试从 CGContextSetFillColorWithColor: invalid context 0x0 中理解,但我不能,因为它在 Objective-C 中。因此,我只想知道,我在这里错过了什么吗?
【问题讨论】:
标签: ios swift xcode uiimageview