indexPathForCell returns nil since ios7

前端 未结 3 1193
陌清茗
陌清茗 2020-11-29 09:10

my app was running fine under ios6.1. tried the ios7 simulator and the following part does not work:

EditingCell *cell = (EditingCell*) [[textField superview         


        
3条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 09:58

    Experiencing this problem in iOS 11, but not in 9 or 10, I overrode the func indexPath(for cell: UITableViewCell) -> IndexPath? method using the technique that @drexel-sharp detailed previously:

    override func indexPath(for cell: UITableViewCell) -> IndexPath? {
        var indexPath = super.indexPath(for: cell)
        if indexPath == nil { // TODO: iOS 11 Bug?
            let point = cell.convert(CGPoint.zero, to: self)
            indexPath = indexPathForRow(at: point)
        }
        return indexPath
    }
    

提交回复
热议问题