[英]Change the size of an accessoryView on UITableViewCell
如何使用 Swift 更改UITableViewCell
上的accessoryView
UITableViewCell
的大小?
This can be done in the UITableView
's cellForRowAt
method:这可以在
UITableView
的cellForRowAt
方法中完成:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "customCellID", for: indexPath) as! CustomTableCell
cell.accessoryView = UIImageView(image: "imageName")
// This is where the magic happens
cell.accessoryView?.bounds = CGRect(x: 0, y: 0, width: 50, height: 50)
return cell
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.