Tag: uirefreshcontrol

为什么UIRefreshControl跳跃?

我尝试用swift 1.2来使用UIRefreshControl,除了用户界面以外,还能正常工作。 这是跳,我不知道为什么。 这是我在做什么: class ViewController: UIViewController { var refreshControl:UIRefreshControl! @IBOutlet weak var tableView: UITableView! override func viewDidLoad() { super.viewDidLoad() self.refreshControl = UIRefreshControl() self.refreshControl.attributedTitle = NSAttributedString(string: "Pull to refresh") self.refreshControl.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged) self.tableView.addSubview(refreshControl) } func refresh(sender:AnyObject) { // Code to refresh table view } } 你可以从这里下载我的POC项目 : POC项目 当你拉下tableView时,突然跳了一下。 有没有人知道为什么? 如果我使用UITableViewController,它工作正常,但我不想使用此UI对象。 我想在UIViewController中使用一个简单的UITableView。

UIRefreshControl在景观

我的桌面上有一个UIRefreshControl。 屏幕在风景。 问题是,为了触发刷新,我不能拉得太远,因为景观中的空间太less。 有没有办法来调整你必须拉下的金额?

使用UIRefreshControl在TableView中移动标题

我的UIRefreshController做了一些奇怪的事情。 当我下拉刷新,tableView标题被移动。 如果我拉下来看起来不错,但是如果我在刷新工作的同时向下滚动表格,那么在UITableCells正常的情况下,标题将被刷新控件的高度所偏移,并在标题后面滚动。 我想避免创build一个tableViewController,所以我在viewDidLoad中执行以下操作: _refreshControl = [[UIRefreshControl alloc] init]; [_refreshControl addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged]; [_tableView addSubview:_refreshControl]; 我有很多不同的视图控制器需要这个function的表。 有没有什么办法可以避免为每一个UITableViewController? 万分感谢!

如何自定义UIRefreshControl不同的图像和位置?

我一直在环顾四周,但找不到这方面的好消息。 我想用不同的加载程序自定义默认的UIRefeshControl 。到目前为止,我只能改变tintColor & attributedTitle属性,我发现大多数代码基本上是创build一个新的"pulltorefresh"效果,但我想要的只是使用UIRefreshControl和定制一下。 这可能吗?

在viewDidLoad上的UIRefreshControl

我正在使用下面的代码来创build一个UIRefreshControl: – (void) viewDidLoad { [super viewDidLoad]; UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; [refreshControl addTarget:self action:@selector(doLoad) forControlEvents:UIControlEventValueChanged]; self.refreshControl = refreshControl; } – (void) doLoad { dispatch_async(dispatch_get_global_queue(0, 0), ^{ // Instead of sleeping, I do a webrequest here. [NSThread sleepForTimeInterval: 5]; dispatch_async(dispatch_get_main_queue(), ^{ [tableView reloadData]; [self.refreshControl endRefreshing]; }); }); } 它工作很好。 如果我导航到我的视图,拖动表,代码运行和数据显示。 不过,我想要做的就是一旦出现“加载”状态(即用户知道正在发生的事情),就可以看到这个状态。 我曾尝试添加以下内容: – (void)viewDidAppear:(BOOL)animated […]

切换UITabBarController中的选项卡后,UIRefreshControl卡住了

我有一个UITableViewController作为UINavigationController中的根视图控制器,它依次是UITabBarController中的视图控制器之一。 所有连接在Storyboard中。 我已经在Storyboard中为我的表configuration了UIRefreshControl,通常看起来应该是在拉时: 但是,如果我在其他选项卡之间切换一次或两次,则如下所示: 它不是旋转或任何东西,只是卡住“完整”,并保持这种方式,直到我完全拉动和刷新。 任何想法或build议感激。

UIRefreshControl与iOS7中的UICollectionView

在我的应用程序中,我使用集合视图的刷新控制。 UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:[UIScreen mainScreen].bounds]; collectionView.alwaysBounceVertical = YES; … [self.view addSubview:collectionView]; UIRefreshControl *refreshControl = [UIRefreshControl new]; [collectionView addSubview:refreshControl]; iOS7有一些令人讨厌的错误,当你拉取集合视图,并且在刷新开始时不松开你的手指时,垂直contentOffset向下移动20-30点,导致难看的滚动跳跃。 如果你在UITableViewController之外使用刷新控制,表格也有这个问题。 但对于他们来说,可以通过将UIRefreshControl实例分配给UITableView的私有属性_refreshControl来轻松解决: @interface UITableView () – (void)_setRefreshControl:(UIRefreshControl *)refreshControl; @end … UITableView *tableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds]; [self.view addSubview:tableView]; UIRefreshControl *refreshControl = [UIRefreshControl new]; [tableView addSubview:refreshControl]; [tableView _setRefreshControl:refreshControl]; 但是UICollectionView没有这样的属性,所以必须有一些手动处理它的方法。