繁体   English   中英

如何在TableView下面添加View?

[英]How to add the View below the TableView?

我应该如何在UITableView下面添加ViewImageView )?

并且可以使用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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM