簡體   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