如何使用 Swift 更改UITableViewCell
上的accessoryView
UITableViewCell
的大小?
This can be done in the UITableView
's cellForRowAt
method:
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
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.