I have created image-view programmatically with constraints
let imgName = "2017-01-18-2.png"
let image = UIImage(named: imgName)
let imgView = UIImageView(image: image!)
imgView.frame = CGRect(x: 0, y: 0, width: 365, height: 667)
view.addSubview(imgView)
But when im running in iPhone 5s its coming with full view (Full view Image) If I'm running in iPhone 7 its coming lil bit up (LilbitUp Image) I have searched all previous questions but all people saying create constraints in storyboard but I want to do with programatically If any help It would be appreciated Thank you in Advance
试试这个
imgView.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.hight)
在Objective-c中
UIview.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.