![](/img/trans.png)
[英]How to add a custom view just below nav bar in a tableview controller?
[英]How to add the View below the TableView?
我应该如何在UITableView
下面添加View
( ImageView
)?
并且可以使用UITableView
滚动视图
因为我的TableItem
可以扩展
您需要实现UITableViewDelegate方法
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
并针对表格的相应部分返回所需的视图(例如,UILabel,其中包含您希望在页脚中显示的文本)。
有点像下面。
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 30.0f;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
UIView *sampleView = [[UIView alloc] init];
sampleView.frame = CGRectMake(x, y, width, height);
sampleView.backgroundColor = [UIColor blackColor];
return sampleView;
}
并包含UITableViewDelegate协议。
@interface TestViewController : UIViewController <UITableViewDelegate>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.