import UIKit
class SalamView: UIView {
@IBOutlet var salamView: UIView!
@IBOutlet weak var salamLogoIMG: UIImageView!
var salamLogoImgOrigY: CGFloat!
var salamLogoImgFromToY: CGFloat!
override init(frame: CGRect) {
super.init(frame: frame)
initializeViews()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initializeViews()
}
private func initializeViews(){
Bundle.main.loadNibNamed("SalamView", owner: self)
salamView.clipsToBounds = true
salamView.setHeight(height: screenSize.height - statusBarHeight)
salamView.setWidth(width: screenSize.width)
addSubview(salamView)
salamLogoImgOrigY = salamLogoIMG.frame.origin.y
salamLogoImgFromToY = -(salamLogoIMG.frame.size.height + salamLogoImgOrigY)
salamLogoIMG.frame = CGRect(x: salamLogoIMG.frame.origin.x,
y: salamLogoImgFromToY,
width: salamLogoIMG.frame.size.width,
height: salamLogoIMG.frame.size.height)
}
}
我需要改变salamLogoIMG的y位置,以salamLogoImgFromToY,如果BTN行动工作运行新的职位代码行,但我需要在第一次设置,请大家帮忙我如何设置新y位置的ImageView在迅速UIView类
如果您想第一次设置它,为什么不从故事板中设置它? –