2016-01-14 80 views
0

这样我加refreshcontroltableview,但是背景颜色是白色的。我如何设置它的默认?谢谢。刷新查看背景颜色

var refreshControl:UIRefreshControl! 
refreshControl = UIRefreshControl() 
refreshControl.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged) 
tableView.addSubview(refreshControl) 

enter image description here

UPD:而且它不工作的顺利开展。

+0

你确定这是所有的refreshControl背景,而不是tableView的超级视图颜色? –

+0

tableview的superview颜色显示在那里,lightgray – aaisataev

+0

使用'refreshControl.backgroundColor'不会帮助吗? – Tj3n

回答

3

如果你的代码是一个UITableViewController里面,你不必添加一个子视图。 UITableViewControllers有refreshControl属性,所以你可以设置

self.refreshControl = UIRefreshControl() 

如果你已经做到了这一点,背景颜色应与您的的tableView的背景颜色。如果你想要一个不同的颜色,你可以使用

self.refreshControl.backgroundColor = UIColor.yourColor() 
0

添加以下行

refreshControl.backgroundColor = UIColor.clearColor() // or any other color you want 
+0

它不起作用 – aaisataev