У меня есть UITableView с таможней UITableViewCell, но у меня странная проблема: если я хочу, чтобы вызывался функция didSelectRowAt, мне нужно нажать на ячейку (и оставаться нажатой) в течение 2 секунд.
Я попытался с помощью функции didHighlightRowAt, которая занимает меньше времени (1 секунда), но мне все еще нужно нажать и подождать секунду, если нет, ничего не происходит.
Моя функция cellForRowAt следующая (яНе знаете, может ли это быть связано?):
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell = StationSearchCellView(style: .default, reuseIdentifier: "cell", station: self.tableSearchesData[indexPath.section])
cell.selectionStyle = .none
return cell
}
Моя пользовательская ячейка:
class StationSearchCellView : UITableViewCell {
var stationName : String? init (
style : UITableViewCellStyle,
reuseIdentifier : String?,
station : String
)
{
super.init (style: style, reuseIdentifier: reuseIdentifier)
self.stationName = station let frameHeight = FDUtils.shared.heightRelativeToLayout (heightInPixels: 60)
let iconSize = FDUtils.shared.widthRelativeToLayout (widthInPixels: 16)
let marginWidth = FDUtils.shared.widthRelativeToLayout (widthInPixels: 20)
// separator
let separator = UIView (
frame : CGRect (x: 0, y: 0-0.5, width: self.frame.width, height: 1)
)
separator.backgroundColor = FDColors.gray707070.withAlphaComponent (0.50)
// Label Station
let labelStation = UILabel (
frame : CGRect (
x : 0,
y : 0,
width : FDUtils.shared.elementsWidth - iconSize - marginWidth,
height : frameHeight
)
)
labelStation.text = station labelStation.setBlack_Left_Regular16 ()
// Image fleche
let searchIcon = UIImageView (
frame : CGRect (
x : labelStation.frame.width,
y : labelStation.frame.height / 2 - iconSize / 2,
width : iconSize,
height : iconSize
)
)
searchIcon.image = UIImage (named: "blue_select_icon")
self.addSubview (separator)
self.addSubview (labelStation)
self.addSubview (searchIcon)
}
required init? (coder aDecoder: NSCoder)
{
fatalError ("init(coder:) has not been implemented")
}
}
Есть идеи?
Спасибо