![](/img/trans.png)
[英]How do I customize a uitableview into different sections with my current setup?
[英]How to customize UIView of sections in UITableView?
我想在UITableView中设置样式,例如viewForFooterInSection
或viewForHeaderInSection
。
我只能使用titleForHeaderInSection
设置标题,使用heightForHeaderInSection
设置高度,但是我想设置背景颜色,字体大小,字体颜色等。
有可能吗?
您可以使用apple提供的委托方法来做到这一点。
//for header
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *myview = [[UIView alloc] init];
//give size for veiw, background color, add label anything here
return myview;
}
//for footer
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
UIView *myview = [[UIView alloc] init];
//give size for veiw, background color, add label anything here
return myview;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.