因为UI设计问题,UITableView的下部分没数据时,必须显示白色,因为导航是蓝色的。下拉刷新时,拉的空白部分也必须是 蓝色的。 因此 百度了很长时间才找到方法, 结合网友的方法 如下:
@property (nonatomic, strong) UIView *refreshBgV;
@property (nonatomic, assign) CGFloat last;
self.refreshBgV = [[UIView alloc] initWithFrame:CGRectMake(0, -SCREEN_HEIGHT-80, SCREEN_WIDTH, SCREEN_HEIGHT)];
self.refreshBgV.backgroundColor = UICOLOR_FROM_HEX(Color4D77FF);
[self.view addSubview:self.refreshBgV];
// scrollView 已经滑动
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGRect frame = self.refreshBgV.frame;
frame.origin.y = frame.origin.y - (scrollView.contentOffset.y - self.last);
self.refreshBgV.frame = frame;
self.last = scrollView.contentOffset.y;
[self.view setNeedsLayout];
}
自己定义的刷新拓展类 高度设置的是80。

image.png