我想用自己的替换Apple的默认单元配件视图。我的代码如下:
var image = UIImage(named: "arrow.pdf")
var imageView = UIImageView(image: image)
cell.accessoryView = imageView
当我运行代码时,我看不到箭头图像。请指教。感谢。
答案 0 :(得分:0)
您可以尝试为您的imageview提供框架
imageView.frame = CGRect(x: 0, Y: 0, width: 40, Height: 40)
而且你也不应该使用.pdf作为图像
答案 1 :(得分:0)
找到答案。我需要提供要查找图像的包。
UIImage(named: "name", in: Bundle.(for: something.self), compatibleWith: nil)
注意:箭头显示正确,即使它是.pdf