現在 iOS9以上で動くアプリを作成していて、詰まりました。
reloadSectionsを実行した際に
iOS10以上は現在の位置そのまま表示されるのですが、
iOS9だと、シミュレータ、実機共に
TableViewのいちばん上まで戻ってしまいます。
if #available(iOS 10.0, *) {
debugLog("iOS10以上")
self.mainTableView.reloadSections(self.SectionIndex, with: UITableViewRowAnimation.automatic)
} else {
debugLog("iOS9以下")
self.mainTableView.beginUpdates()
let nowOffset = self.mainTableView.contentOffset
self.mainTableView.reloadSections(self.SectionIndex, with: UITableViewRowAnimation.automatic)
self.mainTableView.endUpdates()
self.mainTableView.setContentOffset(nowOffset, animated: true)
}
現在は上記のような形です。
更新後に上に行ってしまうのは、Xcode,iOSのバグなのか、仕様なのか
また、トップに行かせずに位置の固定ができるかを教えて下さい。