UITableView
을 사용하여 데이터를 표시하고 있습니다.이미지 UITableView를 스크롤 할 때 이미지가 사라짐
내 데이터는 이미지와 텍스트로 구성됩니다. 문제는 내가 이미지가 사라지는 UITableView
을 스크롤 할 때입니다.
이
내 코드는 다음과UITableView
와
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return msgs.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! collCell
let msg = msgs[indexPath.row]
var decodeImgURL = ""
cell.lbl1.text = msg.content
decodeImgURL = msg.imgurl
if decodeImgURL == "none" {
cell.img.isHidden = true
} else {
let dataDecoded : Data = Data(base64Encoded:decodeImgURL,options: .ignoreUnknownCharacters)!
let decodedImage = UIImage(data: dataDecoded)
cell.img.image = decodedImage
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let msg = msgs[indexPath.row]
if msg.imgurl == "none" {
return 64
} else {
return 207
}
}
'lbl1 '에'msg.content'도 사라지고 있습니까? – thedjnivek
이미지가 맨 처음에도 나타 납니까? –
@thedjnivek 아니요 lbl1은 동일하게 유지됩니다 –