uirefreshcontrol

How to make my RefreshControl appear during ViewDidAppear

白昼怎懂夜的黑 提交于 2019-12-11 08:03:36
问题 I've answered this question myself - just leaving it here now for people with the same issue. My code is fairly simple - A custom table with a datasource to provide data asynchronously from a web service. In order to get the nicest user experience I would like to have the UIRefreshControl animate the process of loading whenever this controller appears, instead of just when the list has been pulled down. Unfortunately the UIRefreshControl does not appear at all if I call my method during

Subclassing UIRefreshControl but still supporting iOS 5.1?

房东的猫 提交于 2019-12-11 06:46:28
问题 Added a UIRefreshControl to one of my tableviews here, and just used respondsToSelector on the the tableview controller to see if it has the refreshControl property before configuring and adding the UIRefreshControl using NSClassFromString(). Works perfectly and I can continue supporting iOS 5.1 (just without them getting the new control). However… I want to override the beginRefreshing and endRefreshing methods to dynamically change the tint color of the control. And I figured subclassing

iOS中UITableViewController自带的刷新控件

喜欢而已 提交于 2019-12-10 18:09:36
iOS中UITableViewController自带的刷新控件 一、引言 在iOS开发中,使用tableView的界面,大多会用到一个下拉刷新的的控件,第三方库中,我们一般会选择比较好用的MJRefresh,其实,在iOS6之后,系统为我们提供了一个原生的刷新控件,使用起来非常方便,只是制定性不强,如果我们没有复杂的需求,使用UIRefreshControl也是不错的一个选择。 二、UITableViewController 相对于UIViewController,UITableViewController只是在内部为我们封装好了一个UITableView,并且遵守好了相关的协议,我们只需要在其中实现方法即可。UITableViewController更多的方面之处是在于下面的这个属性: @property (nonatomic) BOOL clearsSelectionOnViewWillAppear; 这是一个bool值,设置为yes后每当当前controller调用ViewWillAppare的时候,都会将cell的选中状态取消,这十分有用,我们在通过点击cell跳转界面后,pop回来不需要在手动修改cell的选中状态了。 除此之后,TableViewController中还封装了这样一个属性: @property (nonatomic, strong, nullable)

UIRefreshControl freezes when temporarily showing other tab (iOS 7)

此生再无相见时 提交于 2019-12-10 16:37:31
问题 I have the following on one of my tabs: - (void)viewDidLoad { [super viewDidLoad]; self.clearsSelectionOnViewWillAppear = YES; UIRefreshControl* refreshControl = [[UIRefreshControl alloc] init]; refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Sync"]; [refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged]; self.refreshControl = refreshControl; //### Workaround: http://stackoverflow.com/a/19126113/1971013 dispatch

UITableView dragging distance with UIRefreshControl

牧云@^-^@ 提交于 2019-12-10 03:36:38
问题 I'm having some trouble on implementing a UIRefreshControl on a UITableView. Everything is working fine except the fact that I have to scroll something like 80% of the screen for the UIRefreshControl to get triggered. Sometimes I'm not even able to trigger it since there is a tab bar on the bottom of the screen, which cancels the scrolling movement when the finger reaches it. I've looked at other apps, namely Apple's 'Mail', where the UIRefreshControl is triggered after scrolling only 30% of

Implement a horizontal UIRefreshControl

爷,独闯天下 提交于 2019-12-09 21:42:27
问题 How do I go and implement a UIRefreshControl which would get refreshed when pulled from left or right side?? Is it possible with the standard UIRefreshControl? Or is there any API to create this effect? I have been searching a lot to get some lead on this but I am not able to find anything. All I could find is this answer on SO, but it is written in C# which I am not much familiar with. 回答1: You could use a UITableViewController that is rotated 90 degrees. Add [self.view setTransform

How to fix the position of MBProgressHUD to center in a UITableView

杀马特。学长 韩版系。学妹 提交于 2019-12-08 17:40:15
问题 I have a scenario where I am using third party library MBProgressHUD on a UITableViewController but the issues is whenever I scroll up and down the HUD moves with the scroll. I don't want to disable the UITableView scroll and also I want to keep the HUD in the centre of the UITableView. Is there a possible way of implementing it? 回答1: Adding HUD to the tableview's super view or navigationController.view fixes the problem: UIView *view = self.tableView.superview; // UIView *view = self

UIRefreshControl tint color doesn't match given color

别等时光非礼了梦想. 提交于 2019-12-08 16:19:24
问题 The refresh color doesn't match the tint color and looks different, i tryied to change tintAdjustmentMode but the result is the same Just to note, the spinner and text color should be 0x2C76BE tvc.refreshControl = [UIRefreshControl new]; tvc.refreshControl.tintAdjustmentMode = UIViewTintAdjustmentModeNormal; tvc.refreshControl.tintColor = [UIColor colorWithHex:0x2C76BE]; tvc.refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull to query spectrum again" attributes:

UIRefreshControl stops spinning after making application inactive

一世执手 提交于 2019-12-08 14:50:16
问题 I use UIRefreshControl in a UITableView: UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; [refreshControl addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged]; self.refreshControl = refreshControl; With refresh handler: -(void)refresh { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ // (...some long running operation...) dispatch_async(dispatch_get_main_queue(), ^{ [self.refreshControl endRefreshing]; }); })

UIRefreshControl glitching in combination with custom TableViewCell

二次信任 提交于 2019-12-07 15:15:28
I'm having a weird issue where an UIRefreshControl is glitching when I use it in combination with an UITableView and custom UITableViewCells . If I use basic ones (set in the inspector panel in Xcode) it works just fine. See GIFs on Imgur . override func viewDidLoad() { super.viewDidLoad() navigationController?.navigationBar.prefersLargeTitles = true refreshControl = UIRefreshControl() refreshControl?.addTarget(self, action: #selector(self.refresh), for: .valueChanged) tableView.refreshControl = refreshControl refresh() } @objc func refresh() { tableView.reloadData() refreshControl?