簡體   English   中英

TableView 內單元格中照片的大小

[英]Size of a photo in a cell, inside TableView

我需要把照片的具體尺寸。 在 imageView.image 字段中

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        let cell = tableView.dequeueReusableCell(withIdentifier: "Quiz Cell", for: indexPath)
        let row = indexPath.row
        let quiz = model.quizzes[row]

        cell.textLabel?.text = quiz.question
        cell.detailTextLabel?.text = quiz.author?.username ?? "Anónimo"
        cell.imageView?.image = UIImage(named: "none")

        return cell
    }

您需要在單元格本身的Storyboard.xib中設置特定的imageView大小。

如果您不使用Storyboard.xib ,您也可以通過編程方式設置它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM