我的应用程序中已经有大约 5 个UIScrollView,它们都加载了多个.xib文件。我们现在想使用UIRefreshControl. 它们被构建为与 UITableViewControllers 一起使用(每个 UIRefreshControl 类参考)。我不想重新做所有5个UIScrollView工作。我已经尝试UIRefreshControl在我UIScrollView的 's 中使用它,它可以按预期工作,除了一些事情。
刷新图像进入加载器后,
UIScrollView向下跳跃约10个像素,只有当我非常小心地UIScrollview非常缓慢地向下拖动时才会发生这种情况。当我向下滚动并开始重新加载时,松开
UIScrollView,UIScrollView停留在我松开的位置。完成重新加载后,会UIScrollView跳到顶部,没有动画。
这是我的代码:
-(void)viewDidLoad
{
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(handleRefresh:) forControlEvents:UIControlEventValueChanged];
[myScrollView addSubview:refreshControl];
}
-(void)handleRefresh:(UIRefreshControl *)refresh {
// Reload my data
[refresh endRefreshing];
}
有什么办法可以节省大量时间并使用 a UIRefreshControlin aUIScrollView吗?
谢谢你!!!