我有一个UIRefreshControl的表视图.
表的第一行是蓝色,UIRefreshControl背景颜色也是蓝色.
当我向下拖动桌子以刷新它时,我得到了一条白色线条,将桌子和UIRefreshControl分开.
当我停止拖动表格时,此行正在消失.
如何在不更改白色的tableview背景颜色的情况下删除此白线?
附上图片以澄清:
我有一个解决方法来解决这个问题。如果您不想更改表视图的背景颜色,但仍想删除此空间。
基本上创建一个UIView *view
后面的UIRefreshControl
,并将视图的背景颜色设置为您想要的viewDidLoad
方法中的颜色
-(void)viewDidLoad
{
//you implementation of viewDidLoad
self.view = [[UIView alloc]initWithFrame:CGRectMake(0,0,self.view.frame.size.width,0)];
self.view.backgroundColor = [UIColor yourBackgroundColor];
[self.tableView insertSubview:self.view belowSubview:self.refreshControl];
}
Run Code Online (Sandbox Code Playgroud)
然后实现一个UIScrollViewDelegate
方法来动态改变后面视图的高度UIRefreshControl
以掩盖间隙。
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
CGFloat offset = scrollView.contentOffset.y;
[self.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, offset + 20)]; // or any small number
}
Run Code Online (Sandbox Code Playgroud)
请注意,您可能仍然会看到一条线,因为它是表视图的分隔符,您可以更改tableView
分隔符的颜色或样式以将其删除。
归档时间: |
|
查看次数: |
956 次 |
最近记录: |