Development record of developer who study hard everyday.

, ,

How to solve ios issue about UITableViewCell textLabel deprecated

 How to solve ios issue about UITableViewCell textLabel deprecated


ios develop blog

When I practice ios app, I encounter warning about UITableViewCell's deprecated function.

The detail of warning is " 'textLabel' will be deprecated in a future version of iOS: Use UIListContentConfiguration instead, this property will be deprecated in a future release. "

The solution code for this warning is below:

 override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        let cell = tableView.dequeueReusableCell(withIdentifier: "myCell", for: indexPath)

        

        var content = cell.defaultContentConfiguration()

        content.text = items[(indexPath as NSIndexPath).row]

        content.image = UIImage(named: itemsImageFile[(indexPath as NSIndexPath).row])

                

        cell.contentConfiguration = content

        

        return cell

    }


Share:
Location: 대한민국 서울특별시

댓글 없음:

댓글 쓰기