Jack Cowan
Jack Cowan

Reputation: 35

Pull to Refresh Won't Detach (won't stop refreshing) -Objective-C

The issue I'm facing is that my tableView won't stop refreshing after i pull (to refresh) it down. I'm using the Yalantis "Pull to Refresh" repo from github (found here: https://github.com/Yalantis/Pull-to-Refresh.Rentals-iOS) and trying to implement it into my existing project.

I've implemented the header file, added the property but in the instructions it has the unrefresh (if you will) is an IBAction linked to a button. Obviously not what I want. Here is the code I'm working with


Keep in mind that I've taken a lot out and just kept the relevant stuff. Any help would be great. thx.

- (void)viewDidLoad {
[super viewDidLoad];

[self setupRefreshControl];

}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];

[self.sunnyRefreshControl startRefreshing];
PFQuery *query (i perform query for table)
}


# pragma mark - YALSunyRefreshControl methods

-(void)setupRefreshControl{

self.sunnyRefreshControl = [YALSunnyRefreshControl attachToScrollView:self.tableView
                                                               target:self
                                                        refreshAction:@selector(sunnyControlDidStartAnimation)];
}

 -(void)sunnyControlDidStartAnimation{

// start loading something
[self.tableView reloadData];

}



-(IBAction)endAnimationHandle{

[self.sunnyRefreshControl endRefreshing];
}

Upvotes: 2

Views: 470

Answers (1)

edbaev
edbaev

Reputation: 167

Actually you can invoke the method any time you want

[self.sunnyRefreshControl endRefreshing];

the button handler it's just example ^_^

(IBAction)endAnimationHandle{  [self.sunnyRefreshControl endRefreshing];  }

if you still have a question you can create an issue on github repo. Thank you

Upvotes: 2

Related Questions