如何在View
下面添加ImageView
(UITableView
)?
可以使用UITableView
因为我的TableItem
可以展开
答案 0 :(得分:1)
您需要实现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>