Reputation: 14304
I have set a custom footer for tableView via property:
self.tableView.tableFooterView = [self myCustomFooterView];
The tableView fills almost full height in screen, so only 1/3 part of the footer is visible at the bottom. I have disabled bouncing and I can't scroll tableView to bottom to see footerView. If bouncing enabled then I can bounce and see table footer, but table returns to the same position after bounce. It looks like tableView content size does not include my footerView, and that's why I'm unable to scroll. Ay ideas how to fix that?
Upvotes: 3
Views: 2849
Reputation: 14304
JoshHinman is right ("Check the table view's frame and make sure it isn't bigger than the screen."). I'm reusing MyViewController containing tableView in AnotherViewController by adding MyViewController.view to AnotherViewController.view as a subview. Because AnotherViewController.view contains some logo image, MyViewController.view.tableView is pushed to the bottom. As he pointer out, the problem is I have pushed tableView too much :)
Upvotes: 2
Reputation: 20021
You have to set the footer with this datasource method as
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
Also make sure the frame of tableview is satisfyiable that the footer is visible in the view
EDIt This method helps to set footer to every section,so if you want to set the footer set to the last seection after checking the section returned in the method.
well as the asker intented this worked for me
UIView *view1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 40)];
[view1 setBackgroundColor:[UIColor redColor]];
[self.view addSubview:view1];
[self.table setTableFooterView:view1];
and so check [self myCustomFooterView];
Upvotes: 0
Reputation:
Also write following code, after you set your footer of UITableView
:
CGSize wholesize = self.tableView.contentSize;
wholesize.height = self.tableView.contentSize.height + self.tableView.tableFooterView.frame.size.height;
self.tableView.contentSize = wholesize;
[tableView setContentOffset:CGPointMake(0, tableView.contentSize.height) animated:YES];
self.tableView.tableFooterView.userInteractionEnabled = YES;
Upvotes: 0