vlasov / CCBottomRefreshControl

MIT License
319 stars 77 forks source link

The refresh icon does not disappear sometimes #25

Open joe528 opened 8 years ago

joe528 commented 8 years ago

Sometimes I found the app has the refresh icon at the bottom when I scroll up. It will not disappear until I scroll down to bottom again to refresh it.

If I try to reproduce it "deliberately", I can never reproduce it.

But it does happen from time to time. I have seen it several times in the past few days.

Rarely seen but it happens time to time to give weird user experience.

abereghici commented 8 years ago

Did you find a solution for this issue?

joe528 commented 8 years ago

No. Did you reproduce the same issue?

abereghici commented 8 years ago

Yes. I didn't find how to fix this issue in library, but I found another solution :

override func viewDidAppear(animated: Bool) {
        self.tableView.bottomRefreshControl = self.bottomRefreshControl
        self.bottomRefreshControl.beginRefreshing()
        self.bottomRefreshControl.endRefreshing()
    }
override func viewDidDisappear(animated: Bool) {
        self.tableView.bottomRefreshControl = nil
    }
joe528 commented 8 years ago

@abereghici nil it in viewDidDisappear is not helping for me because it means the end of my app.

abereghici commented 8 years ago

@joe528 Try this :

override func viewDidAppear(animated: Bool) {
        self.bottomRefreshControl.beginRefreshing()
        self.bottomRefreshControl.endRefreshing()
    }
joe528 commented 8 years ago

Why would calling these two functions in viewDidAppear resolve my issue? I don't get it. The issue happens when I scroll up at the bottom of a table view. Most times, the refresh icon will disappear as designed, and only in rare condition, the refresh icon does not disappear.

abereghici commented 8 years ago

@joe528 Oh, okay. I didn't understand right your question. This piece of code is working when you have 2 controllers, and when you navigate back, refresh controller appears on bottom of the screen.

joonorbertsv commented 8 years ago

I think I had the same issue. Changing if (offset > 0) into if (offset >= 0) inside - (void)brc_setContentOffset:(CGPoint)contentOffset seems to fix the issue.

joe528 commented 8 years ago

@joonorbertsv thanks for the suggestion, I will give it a try and observe it for a while to see if I will never see this issue again (because I can't reproduce it "deliberately")

JustSAT commented 7 years ago

I have the same issue. This helped me

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.tableView.bottomRefreshControl = nil;
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    self.tableView.bottomRefreshControl = self.bottomRefreshControl;
}