Skip to content

Instantly share code, notes, and snippets.

@julian-weinert
Created August 26, 2015 09:48
Show Gist options
  • Save julian-weinert/afe440f1e4f4fd5d5fb6 to your computer and use it in GitHub Desktop.
Save julian-weinert/afe440f1e4f4fd5d5fb6 to your computer and use it in GitHub Desktop.
`-scrollViewDidScroll` not called when `UITableView` removes a section and must scroll
@interface GISTViewController : UITableViewController
@end
@implementation GISTViewController
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 3;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0) {
return 1;
}
else if (section == 1) {
if ([tableView isEditing]) {
return 10;
}
else {
return 0;
}
}
else if (section == 2) {
return 2;
}
return 0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
return [tableView dequeueReusableCellWithIdentifier:@"identifier" forIndexPath:indexPath];
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
[[self tableView] reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationAutomatic];
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
NSLog(@"hey there, Im scrolling!");
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment