![](/img/trans.png)
[英]how to fit collection view cell in table view cell ( adaptive on all screen sizes?)
[英]how to Fit image view in the Screen in all iPhoneScreens
我已經使用約束以編程方式創建了圖像視圖
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)
但是,當我在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.