【发布时间】:2021-05-21 19:59:08
【问题描述】:
我有一个UIView,其中包含两个标签。我希望视图调整大小,使其包含每个标签中的所有文本,但文本溢出视图。这是我的代码:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: K.reuseIdentifier, for: indexPath) as! NoteTableViewCell
cell.titleLabel?.text = titleArray[indexPath.row]
cell.mainTextLabel?.text = noteArray[indexPath.row]
cell.titleLabel?.font = UIFont(name:"HelveticaNeue-Bold", size: 18.0)
cell.cardView?.sizeToFit()
cell.cardView?.layer.shadowOpacity = 1
cell.cardView?.layer.shadowOffset = .zero
cell.cardView?.layer.shadowRadius = 1
cell.cardView?.layer.cornerRadius = 8
return cell
}
【问题讨论】:
标签: ios swift uiview constraints