史丹佛ios9教學

2016年12月17日 星期六

[SWIFT3]Costmos TableView Cell

// set the color in tableView header  

override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {

    let headerView = UIView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: 20))
    headerView.backgroundColor = .lightGray
    
    return headerView
    }

//set the height of tableViewHeader
    override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 22

    }

沒有留言:

張貼留言