I am trying to get a UITableview to go to the top of the page when I reload the table data when I call the following from
- (void)pickerView:(UIPickerView *)pic
After considering the options discussed above my version of the solutions is the following. It works consistently in iOS 11 & 12 for both UICollectionView & UITableView.
UICollectionView:
DispatchQueue.main.async { [weak self] in
guard self?..first != nil else { return }
self?.collectionView.scrollToItem(at: IndexPath(row: 0, section: 0),
at: .top,
animated: false)
}
UITableView:
DispatchQueue.main.async { [weak self] in
guard self?..first != nil else { return }
self?.collectionView.scrollToRow(at: IndexPath(row: 0, section: 0),
at: .top,
animated: false)
}