DaveS
27 November 2022 22:54
1
I am trying to adapt an iOS application to use the “Designed for iPad” schema on my M1 Mac
Everything seems to work EXCEPT clicking a cell in a UITableview
internal func tableView(_ tableView: UITableView,didSelectRowAt indexPath: IndexPath) {
never fires when running on a Mac, but works perfectly on Iphone/iPad
So far can find hardly ANY information about this mode on the 'Net
DaveS
27 November 2022 23:15
2
as a “BAND-AID” I added a SingleTap … which seems to work, don’t know why it is required
let singleTapGesture: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(gameSngTap(_:)))
singleTapGesture.numberOfTapsRequired = 1 // add double tap
tblGAMES.addGestureRecognizer(singleTapGesture)
@objc func gameSngTap(_ gesture: UITapGestureRecognizer) {
let pointInTable : CGPoint = gesture.location(in: tblGAMES)
let selectedIndexPath : IndexPath = tblGAMES.indexPathForRow(at: pointInTable)!
tblGAMES.selectRow(at: selectedIndexPath, animated: false, scrollPosition: .none)
tblGAMES.delegate?.tableView!( tblGAMES, didSelectRowAt: selectedIndexPath)
}