[英]Change image size of cell image in static table
Q1:我要控制圖像的高度和寬度
答:最初檢查tableviewCell類型是否為Custom ,如果不是custom ,則將單元格類型更改為custom,並且您想要固定的寬度和高度,然后在情節提要中更改以下幾行
imageView.clipsToBounds = true
imageView.contentMode =.scaleAspectFit
Q2:需要更改每個單元中存在的“附件”的x位置。(請參閱參考圖像2)
答:在您的RearView上更改tableview的寬度(不是全屏寬度,請使用fullscreenwidth-30)
如果您的后視圖為tableviewcontroller,則在viewWillAppear或ViewDidAppear中更改框架
func viewDidAppear(_ animated: Bool) {
super. viewDidAppear(animated)
tableView.frame = CGRect(x: 0, y: yourYPosition, width: self.view.frame.size.width - 30, height: self.view.frame.size.height)
UIApplication.shared.keyWindow?.backgroundColor = UIColor.white
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.