【问题标题】:Giving color to the title in tableView in iphone为iphone中tableView中的标题赋予颜色
【发布时间】:2011-01-06 22:02:56
【问题描述】:

我是 iPhone 开发的新手。我想将标题的颜色更改为棕色。默认情况下,它是灰色的。要显示标题,我使用以下方法:

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    return @"Title";
}

我想更改标题背景颜色。

请帮帮我。

谢谢。

【问题讨论】:

    标签: iphone uitableview title background-color


    【解决方案1】:

    您必须创建一个 UIView 子类,该子类与默认提供的内容非常接近。然后更改标签的颜色。然后就可以实现了:

    - (UIView *)tableView:(UITableView *)tableView 
                    viewForHeaderInSection:(NSInteger)section;
    

    应该返回您的自定义视图。

    【讨论】:

      【解决方案2】:

      - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger) section

      可能是您正在寻找的方法。

      【讨论】:

        猜你喜欢
        • 2012-02-17
        • 1970-01-01
        • 2015-07-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-10-19
        • 2015-01-31
        • 1970-01-01
        相关资源
        最近更新 更多