0
그래서 적절한 셀 detailedTitle에 대한 여러 줄 텍스트를 만들려고합니다. 그러나 cell.numberOfLines = 0으로 설정하면 여러 줄이 생기지 만 셀에 올바른 간격이 없습니다. 또한 cellAutoDimentions를 호출 시도했지만 텍스트를 볼 수 밀려 점점 만약 내가 내 프로그램스위프트 3 : UITable 셀 여러 줄 문제
에 그 코드를 실행하면 그것은
cell.detailTextLabel?.numberOfLines = 0
나는 다음과 같은 결과를 가져옵니다 차이를하지 이 경우 셀 범위의 위쪽과 아래쪽은 오른쪽이 아니라고 말하는데, 그 문제는 CGRect를 변경하여 수정하는 방법을 알고 있습니다. 또한 코드는 2 개 이상의 라인
허용하지 않습니다UPDATE :
다음 내 코드의 전체 부분이
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return itorStorage.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = self.messageField.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! MessageCustomCell
cell.backgroundColor = LightBlue
cell.textLabel?.text = itorStorage[indexPath.row].name
cell.textLabel?.textColor = .white
cell.detailTextLabel?.text = itorStorage[indexPath.row].text
cell.detailTextLabel?.textColor = .white
cell.pic.image = itorStorage[indexPath.row].image
cell.timeStamp.text = itorStorage[indexPath.row].time
cell.detailTextLabel?.numberOfLines = 0
cell.detailTextLabel?.lineBreakMode = .byWordWrapping
return cell
}
override init() {
super.init()
messageField.delegate = self
messageField.dataSource = self
messageField.tableFooterView = UIView(frame: CGRect.zero)
messageField.rowHeight = UITableViewAutomaticDimension
messageField.allowsSelection = false
self.messageField.register(MessageCustomCell.self, forCellReuseIdentifier: "Cell")
ratingView.didFinishTouchingCosmos = didTouchCosmos
}
나는이 솔루션을 시도하지만 동일한 결과 – Sina
당신이 당신의 코드 (특히 다른있는 tableview 위임 및 데이터 소스 기능)을 더 추가 할 수거야? heightForRow를 구현 했습니까? 그렇다면 제거하십시오 – mlidal
위의 추가 코드를 추가했습니다! – Sina