iOS tableView 底部顯示"沒有更多記錄了"
阿新 • • 發佈:2018-12-10
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ UIView* sh_footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width , 60.0)]; UILabel *sh_label = [[UILabel alloc ]init ]; sh_label.frame = CGRectMake(20, 20, kScreen_Width- 40 , 20); sh_label.text = @"----沒有更多記錄了----"; sh_label.textColor = [UIColor lightGrayColor]; sh_label.font = [UIFont systemFontOfSize:15]; sh_label.textAlignment = NSTextAlignmentCenter; [sh_footerView addSubview:sh_label]; return sh_footerView; return nil; }
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
if (section == 0) {
return 0.1;
}else if (section == 1){
return 4;
}else{
return 0.000001f; // 設定為0.0001 是為了不懸浮
}
return 0.1;
}