[ad_1]
When I run the application with Command + R
, the tableView
responds normally, but when I exit the application and reopen it, the cells
do not respond when I tap the tableView.
This problem did not occur when I ran the same code in an application I created as a test.
This problem only occurs in the production application.
My guess is that the problem is on the configuration side of the application. However, I do not know where the problem is.
code
import Foundation
import UIKit
class TableViewMT: UITableView {
init() {
super.init(frame: .zero, style: .plain)
self.delegate = self
self.dataSource = self
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
extension TableViewMT: UITableViewDelegate, UITableViewDataSource{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 2
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell()
cell.layoutMargins = .zero
cell.preservesSuperviewLayoutMargins = false
cell.contentView.isUserInteractionEnabled = false
cell.textLabel?.text = "test\(indexPath.row)"
return cell
}
}
If you have any idea of this problem, please let me know.
My environment:
Xcode 13.4
iOS 15.4
My native language is not English, so there may be mistakes in the text.
[ad_2]