If no Table View results, display “No Results” on screen

后端 未结 14 1638
挽巷
挽巷 2020-11-30 17:25

I have a tableview, where sometimes there might not be any results to list, so I would like to put something up that says \"no results\" if the

14条回答
  •  星月不相逢
    2020-11-30 17:59

    SWIFT 3

            let noDataLabel: UILabel     = UILabel(frame: CGRect(x: 0, y: 0, width: tableView.bounds.size.width, height: tableView.bounds.size.height))
            noDataLabel.text             = "No data available"
            noDataLabel.textColor        = UIColor.white
            noDataLabel.font             = UIFont(name: "Open Sans", size: 15)
            noDataLabel.textAlignment    = .center
            tableView.backgroundView = noDataLabel
            tableView.separatorStyle = .none
    

提交回复
热议问题