![](/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.