Reload tableview section without scroll or animation
Try this:
UIView.setAnimationsEnabled(false)
self.tableView.beginUpdates()
self.tableView.reloadSections(NSIndexSet(index: 1) as IndexSet, with: UITableViewRowAnimation.none)
self.tableView.endUpdates()
Tableview with no animation still jitters when I reload section
2 things were needed:
Get a reference/pointer to the headerView. E.g. this answer.
Have your button as a property. I was originally having it just as a subview. That wasn't enough!
To do such I made my sectionHeader aUITableViewHeaderFooterView
subclass and then added the button as a property.
Then I was simply able to change the isEnabled
property of the button.
UITableView Refresh without scrolling
I am showing if only one row is being added. You can extend it to multiple rows.
// dataArray is your data Source object
[dataArray insertObject:name atIndex:0];
CGPoint contentOffset = self.tableView.contentOffset;
contentOffset.y += [self tableView:self.tableView heightForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
[self.tableView reloadData];
[self.tableView setContentOffset:contentOffset];
But for this to work you need to have defined - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
the method. Or else, you can directly give your tableview row height if it is constant.
Reload tableView section without reloading header section - Swift
You could use UITableView
's reloadSections
method instead.
tableView.reloadSections(IndexSet(integer: 2), with: .none)
How to reload a section header without it disappearing/re-appearing in Swift?
Found a solution referenced by @Abhinav:
Reload tableview section without scroll or animation
Slight modification updated for Swift 3.0:
UIView.performWithoutAnimation {
self.tableView.beginUpdates()
self.tableView.reloadSections(indexSet, with: UITableViewRowAnimation.none)
self.tableView.endUpdates()
}
Now if I scroll past the number of visible cells on screen and I delete a row, the headerCell.theCountLabel.text
in my section header is updated without any animation, and remains still.
Related Topics
Where Are iOS Simulator Screenshots Stored
iOS App Crashing Every Other Launch, Can't Find Error
How to Change Navigation Bar Color in iOS 7 or 6
Invalid Update: Invalid Number of Items on Uicollectionview
Extracting H264 from Cmblockbuffer
iOS How to Asynchronously Download and Cache Images and Videos for Use in My App
Why Does Uiviewcontroller Extend Under Uinavigationbar, While Uitableviewcontroller Doesn'T
Set Background Gradient on Button in Swift
Apply Gradient Color to Arc Created with Uibezierpath
Get Latitude/Longitude from Address
Assertion Failure When Using Uisearchdisplaycontroller in Uitableviewcontroller
Xcode Won't Let to Build for Device After Denying Codesign to Access Keychain
How to Convert Including Timezone Date in Swift
How to Count Rows in a Parse Class Programmatically in an iOS App Using Swift
Why My Nsdateformatter Returns Null