[英]how to Fit image view in the Screen in all iPhoneScreens
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 但是,当我在iPhone 5s中运行它的全视图(全视图图像)如果我在iPhone 7中运行它即将升级(LilbitUp图像)我已经搜索了所有先前的问题,但所有人都说在故事板中创建约束但我想以编程方式做,如果有任何帮助,将不胜感激,谢谢你提前
试试这个
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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.