【发布时间】:2016-01-11 01:37:08
【问题描述】:
我希望使用 Swift 更改 UITableView 的背景颜色。我想让单元格背景和实际表格的背景都成为特定颜色。到目前为止,我已经用这段代码创建了一个简单的表:
import UIKit
class MyTripsViewController: UIViewController, UITableViewDelegate {
override func viewDidLoad() {
super.viewDidLoad()
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 2
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cell")
cell.textLabel?.text = "Test"
return cell
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
【问题讨论】:
标签: ios swift uitableview