sách gpt4 ăn đã đi

iphone - 如何为表格中的每个部分添加标题标题

In lại 作者:太空狗 更新时间:2023-10-30 03:37:10 25 4
mua khóa gpt4 giày nike

我的 UITableView 中有四个部分,如何为每个部分添加标题?我正在使用以下代码,但它不起作用。

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { 

if (section == 0)
return @"Tasks";

if (section == 1)
return @"Appointments";

if (section == 2)
return @"Activities";

if (section == 3)
return @"Inactivities";
}

câu trả lời hay nhất

你确定你已经实现了 tableView:heightForHeaderInSection: ?

在您的情况下,标题实际上已设置,但标题的高度默认为 0。如果您还没有添加此 UITableViewDelegate phương pháp:

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { 
return 40; //play around with this value
}

附言:考虑在此类方法中使用 công tắc tuyên bố

关于iphone - 如何为表格中的每个部分添加标题标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5619584/

25 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress