//关闭tableview的预估cell,heard &foot高度,解决tablevie滚动指定位置不准确
_tableview.estimatedRowHeight = 0;
_tableview.estimatedSectionHeaderHeight = 0;
_tableview.estimatedSectionFooterHeight = 0;
[self.tableview reloadData];
[self.tableview layoutIfNeeded]; //这句是关键 马上刷新界面 就用layoutIfNeeded ,主要是解决cell的高度不固定,导致cell无法滚动到顶部
if (isTop) {
[self.tableview selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:2] animated:NO scrollPosition:UITableViewScrollPositionTop];
}
//tableview的heardview是悬浮置顶的,所以判断下 这里可以不用
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
CGPoint point=scrollView.contentOffset;
NSLog(@"%f,%f",point.x,point.y);
int y = (60+260*myscale);
if ([self.interactiveUnreadMessagesNumberStr intValue]>0) {
y= y+54;
}
if (point.y>y) {
isTop = YES;
}else {
isTop = NO;
}
}