views:

65

answers:

2

I am using the EGOTableViewHeader class provided from:

http://www.drobnik.com/touch/2009/12/how-to-make-a-pull-to-reload-tableview-just-like-tweetie-2/

I am able to display my view at the top of my UITableView:

refreshHeaderView = [[EGORefreshTableHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f - self.tableView.bounds.size.height, 320.0f, self.tableView.bounds.size.height)];
refreshHeaderView.backgroundColor = [UIColor colorWithRed:226.0/255.0 green:231.0/255.0 blue:237.0/255.0 alpha:1.0];
[self.tableView addSubview:refreshHeaderView];

How can I figure out the Y-Coordinate to show this view at the bottom of the last cell in my UITableView?

A: 

Can you be a bit more specific? Are there more cells that scroll into place? I'm guessing your tableview has more cells than the screen real-estate provides, so do you want your view to come into place as the last cell is scrolled upward?

Edit: Personally, the idea of figuring out content height on a table view is too messy, especially since you have to add the subview yourself, rather than have the UITableView manage it for you. There is a more elegant solution that works in my opinion:

Create an extra section (that doesn't have to have any rows associated with it). Then implement the function

tableView:viewForHeaderInSection:

Return the view you were meaning to add as a subview under your main table. That should do the trick.

mdizzle
that is correct, I want my view to come into place as the last cell is scrolled upward.
Sheehan Alam
Added my solution, let me know if you have questions/concerns
mdizzle
A: 

You can get the position of the very bottom of a tableView by using self.tableView.contentSize.height.

So your code becomes
refreshHeaderView = [[EGORefreshTableHeaderView alloc] initWithFrame:CGRectMake(0.0f, self.tableView.contentSize.height, 320.0f, self.tableView.bounds.size.height)];

Once you have the position just add the view to your tableView as you did with the previous one.

Domestic Cat