UITableView,Separator颜色在哪里设置? [英] UITableView, Separator color where to set?

查看:171
本文介绍了UITableView,Separator颜色在哪里设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IB中添加了一个 UITableView ,并设置委托和数据源,一切正常。我想做的下一步是更改分隔符的颜色,但我唯一的方法,我可以找到这样做是添加到一个委托回调的方法,是否有一个更好的地方,我应该把这个?

I have added a UITableView in IB and set the "delegate" and "datasource" and all is working well. What I wanted to do next was change the separator color, but the only way I could find to do this was to add the method to one of the delegate callbacks, is there a better place I should put this?

我现在没有这个,但我想,也许我需要添加一个iVar从我的控制器,我可以链接到 UITableView 在IB中,然后在 viewDidload ?中设置分隔符颜色

I don't have this at the moment but I was thinking that maybe I need to add an "iVar" from my controller that I can link to the UITableView in IB and then set separator color in the viewDidload?

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView setSeparatorColor:[UIColor blackColor]];
    return 65;
}


推荐答案

- (void)viewDidLoad
{
   [self.tableView setSeparatorColor:[UIColor myColor]];
}



我希望有帮助 - 您需要自己。以访问它,记住。

这篇关于UITableView,Separator颜色在哪里设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆