enormego / EGOTableViewPullRefresh

A similar control to the pull down to refresh control created by atebits in Tweetie 2.
http://developers.enormego.com
3.26k stars 878 forks source link

Does not always display when tableview created in UIViewController #31

Open timothycosta opened 13 years ago

timothycosta commented 13 years ago

This was working perfectly when I used it with a UITableViewController. But I am now trying to use it in a UIViewController, where I programmatically create the tableView. Most of the time the refresh header does not get shown, although a white area does get pulled down, and stays down while the view is refreshing.

When it does show, my table view header (not EGO) gets created twice, and the refresh header gets shown below the top duplicate header. However, even when removing my header it does not show properly.

Here is a screenshot:

https://lh6.googleusercontent.com/-eUGkPqmO4eE/Tm5OqoUBQvI/AAAAAAAABM4/ctJPGAZnEc4/s800/PulldownRefreshBug.png

devindoty commented 13 years ago

Can you show the code you're using to setup the table view and table view header?

dannewns commented 12 years ago

Im having a similar issue with regards to the refresh header not getting shown my code looks like the following (im still new to iOS so dont shoot me)

setting up table view

orderHistoryTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 480) style:UITableViewStylePlain]; 
[orderHistoryTable setDelegate:self];
[orderHistoryTable setDataSource:self];

setting up egorefresh
if (pullToRefreshHeaderView == nil) {
    EGORefreshTableHeaderView *view = [[EGORefreshTableHeaderView alloc]  initWithFrame:
                                       CGRectMake(0.0f, 0.0f - self.view.bounds.size.height,
                                                  320.0f, self.view.bounds.size.height)];
    view.delegate = self;
    [self.view  addSubview:view];
    pullToRefreshHeaderView = view;
    [view release];            
}

have i missed something out, the mechanism seems to be working i.e. the white area holds for a bit and then disappears as you would expect them to.

any help would be much appreciated. thanks

Dan

devindoty commented 12 years ago

The view is there, just the frame is a bit off. Initialization should look like this.

EGORefreshTableHeaderView *view = [[EGORefreshTableHeaderView alloc] initWithFrame:CGRectMake(0.0f, -60.0f, 320.0f, 60.0ft)];

It should also get added to the table view, not self.view, unless you're using a UITableViewController.

[orderHistoryTable addSubview:view];