views:

74

answers:

1

Hi

I am using the three20 library for an iPhone project. As part of it I am using a pull to refresh (like fb and twitter) on a tableview. It works great, however it would be better if it was at the bottom of the tableview.

I cant see any obvious configuration settings to do this (basically no API docs), so I have dug around and it looks like I have to roll out my own implementation of TTTableViewDragRefreshDelegate

I have found the code which adds the actual drag button (removed irrelevant bits):

- (id)initWithController:(TTTableViewController*)controller {
    if (self = [super initWithController:controller]) {
        // Add our refresh header
        _headerView = [[TTTableHeaderDragRefreshView alloc]
                      initWithFrame:CGRectMake(0,
                                                -_controller.tableView.bounds.size.height,
                                                _controller.tableView.width,
                                                _controller.tableView.bounds.size.height)];
        _headerView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
        _headerView.backgroundColor = TTSTYLEVAR(tableRefreshHeaderBackgroundColor);

        [_controller.tableView addSubview:_headerView];
}

But I am quite inexperienced with moving view stuff within code so I'm not really sure where to start. Any ideas?

A: 

Instead of adding it to the header of the UITableView, have you tried adding it to the footer instead?

You can access this via self.tableView.tableFooterView ..A warning though: I have not tried this with the three20 code and he may be checking that the user is scrolling to the top and then refreshes the table. You'd have to look into this a bit more yourself. You may also have to mess around with the frame to get it to look right (not at my laptop or I'd be able to help a little bit more).

Try changing your code to:

[_controller.tableView.tableFooterView addSubview:_headerView];

More info here: http://developer.apple.com/iphone/library/documentation/uikit/reference/UITableView_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006943-CH3-SW4

iWasRobbed