let templateImage = UIImage(named:"marker")?.withRenderingMode(.alwaysTemplate)
self.imageView.image = templateImage
self.imageView.contentMode = .scaleAspectFit
self.imageView?.tintColor = UIColor.red
self.imageView?.tintAdjustmentMode = .normal
self.imageView.backgroundColor = .clear
我使用的是 Swift 3
但我需要的是用黑色填充淡色区域边框,如下图所示:
标记图标在这里:
最佳答案
您是否尝试为图像内容添加边框?如果是,那就不可能了。
您可以使用以下几行为 ImageView 添加边框:
self.imageView.layer.borderwidth = 1 //as per your requirement
self.imageView.layer.borderColor = UIColor. blackColor().CGColor
关于ios - 在 uiimageview 中具有边框的着色区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47586687/