Tag: uirefreshcontrol

UIRefreshControl iOS 6 xcode

有没有人有一个如何实现新的UIRefreshControl到Xcode的简短的例子。 我有一个显示推文的UITableViewController ,希望能够下拉和刷新。

我可以在UIScrollView中使用UIRefreshControl吗?

我有约5个UIScrollView已经在我的应用程序,所有加载多个.xib文件。 我们现在想要使用UIRefreshControl 。 它们被构build为与UITableViewControllers一起使用(每个UIRefreshControl类的引用)。 我不想重新做5个UIScrollView工作。 我已经尝试在我的UIScrollView使用UIRefreshControl ,除了一些事情之外,它的工作方式和预期一样。 在刷新图像变成加载程序之后, UIScrollView向下跳跃约10个像素,这在我非常小心地非常缓慢地拖动UIScrollview时候才会发生。 当我向下滚动并启动重新加载,然后放开UIScrollView , UIScrollView停留在我放开的位置。 完成重新加载后, UIScrollView跳转到顶部,没有animation。 这是我的代码: -(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]; } 有什么办法可以节省一大堆时间,并在UIScrollView使用UIRefreshControl ? 谢谢!!!

UIRefreshControl – 当UITableViewController位于UINavigationController中时,beginRefreshing不工作

我已经在我的UITableViewController(这是一个UINavigationController内)设置一个UIRefreshControl和它按预期的方式工作(即拉下来触发正确的事件)。 但是,如果我以编程方式调用刷新控件上的beginRefreshing实例方法,如: [self.refreshControl beginRefreshing]; 什么都没发生。 它应该animation下来,并显示微调。 刷新后调用endRefreshing方法时可以正常工作。 我用这种行为掀起了一个基本的原型项目,它正常工作时,我的UITableViewController直接添加到应用程序委托的根视图控制器,例如: self.viewController = tableViewController; self.window.rootViewController = self.viewController; 但是,如果我首先添加tableViewController到一个UINavigationController,然后添加导航控制器作为rootViewController , beginRefreshing方法不再起作用。 例如 UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:tableViewController]; self.viewController = navController; self.window.rootViewController = self.viewController; 我的感觉是,这与导航控制器中的嵌套视图层次结构有关,不能很好地进行复习控制 – 任何build议? 谢谢

UICollectionView上的UIRefreshControl只在集合填充容器的高度时起作用

我试图添加一个UIRefreshControl到UICollectionView ,但问题是刷新控件不会出现,除非集合视图填满其父容器的高度。 换句话说,除非收集视图足够长以至于需要滚动,否则不能被拉下以显示刷新控制视图。 只要收集超过其父容器的高度,它将被拉下并显示刷新视图。 我已经build立了一个快速的iOS项目,在主视图中只有一个UICollectionView ,带有一个集合视图的出口,这样我就可以在viewDidLoad添加UIRefreshControl 。 还有一个重用标识符cCell的原型单元格 这是控制器中的所有代码,它很好地说明了这个问题。 在这段代码中,我将单元格的高度设置为100,这不足以填充显示,因此无法拉取视图,刷新控件也不会显示。 将其设置为更高的值以填充显示,然后运行。 有任何想法吗? @interface ViewController () <UICollectionViewDelegateFlowLayout, UICollectionViewDataSource> @property (strong, nonatomic) IBOutlet UICollectionView *collectionView; @end @implementation ViewController – (void)viewDidLoad { [super viewDidLoad]; UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; [self.collectionView addSubview:refreshControl]; } -(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return 1; } -(UICollectionViewCell *)collectionView:(UICollectionView […]

如何使用拉来刷新Swift?

我正在使用swift构build一个RSS阅读器,并需要实现拉来重新加载function。 这是我如何做到这一点。 class FirstViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet var refresh: UIScreenEdgePanGestureRecognizer @IBOutlet var newsCollect: UITableView var activityIndicator:UIActivityIndicatorView? = nil override func viewDidLoad() { super.viewDidLoad() self.newsCollect.scrollEnabled = true // Do any additional setup after loading the view, typically from a nib. if nCollect.news.count <= 2{ self.collectNews() } else{ self.removeActivityIndicator() } view.addGestureRecognizer(refresh) } @IBAction func reload(sender: […]

没有UITableViewController的UIRefreshControl

只是好奇,因为它似乎不可能,但是有没有偷偷摸摸的方式来利用新的iOS 6 UIRefreshControl类而不使用UITableViewController子类? 我经常使用带有UITableView子视图的UIViewController ,并且符合UITableViewDataSource和UITableViewDelegate而不是直接使用UITableViewController 。