我已使用UIImageView
,
lazy var
我想根据它的superView设置redArrowImage
的x位置,它将在运行时定义。
lazy var redArrowImage: UIImageView = {
let imageView = UIImageView(image: UIImage(named: "red"))
imageView.frame = CGRect(x: self.goButton.frame.size.width - 25, y: 12, width: 15, height: 15)
imageView.contentMode = .scaleAspectFit
return imageView
}()
我使用了self.superview.frame.size.width - 25
,但它不起作用:(
imageView.frame = CGRect(x: self.superview.frame.size.width - 25, y: 12, width: 15, height: 15)
有什么想法吗?