自定义IOS分隔符

时间:2013-08-06 16:45:31

标签: iphone ios objective-c uitableview

下面的'或'分隔符如何制作?它是在标题标题中使用的图像吗?

enter image description here

3 个答案:

答案 0 :(得分:3)

如果真的是通过表视图完成的,那么它是通过"tableView:viewForHeaderInSection:"的委托方法完成的。

答案 1 :(得分:0)

是的,它是用于节标题的图像。

答案 2 :(得分:0)

该登录页面正在修改UITableView的页眉/页脚视图。

在设置表格视图时,您需要使用以下UITableView委托方法,以便在表格视图的每个部分中创建页眉和页脚视图。

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    // Set your custom view for the header in the section
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    // Set your custom view for the footer in the section
}

- (CGFloat) tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section
{
    // Set the height of the header in each section
}

- (CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    // Set the height of the footer in each section
}

注意:如果你注意到前两个方法返回一个UIView,那么它不一定只是一个图像。您可以创建所需的任何自定义视图,并将其放在tableView页眉/页脚中。视图可以是UIKit元素,UIImage,甚至是使用CoreGraphics制作的。