2016-08-09 2 views
1

Я пытаюсь несколько решения, как это сделать мое UITableView прозрачногоКак сделать UITableView прозрачным

func tableView(tableView: UITableView, cellForRowAtIndexPath  indexPath: NSIndexPath) -> UITableViewCell { 
     tableView.backgroundColor=UIColor.clearColor() 
    let cell = tableView.dequeueReusableCellWithIdentifier("signCell", forIndexPath: indexPath) as! SignUpTableViewCell 


    cell.backgroundColor=UIColor.clearColor() 
    cell.signInfo.text="Mee" 

    return cell 
} 

и начертание текста прозрачным также, но таблица и текст после этого исчезают.

+0

С.Е. тыс раз http://stackoverflow.com/questions/1008246/how-to-create-a-uitableviewcell- с-a-transparent-background –

+0

tableView.backgroundColor = UIColor.clearColor() –

+0

@ Anbu.Karthik Я хочу решение в swift – Sam

ответ

2

Попробуйте этот код в ViewDidLoad

_tableView.backgroundColor = UIColor.clearColor() 
0

В некоторых ситуациях, установка tableView.backgroundColor не работает, а фон из Tableview всегда белый. Я наткнулся на этот вопрос при использовании UITableView в пользовательских UIView и решить ее с этим:

public func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {   
    tableView.backgroundColor = UIColor.clear 
}