DZNEmptyDataSet icon indicating copy to clipboard operation
DZNEmptyDataSet copied to clipboard

tableView.tableHeaderView returning ni

Open mhlangagc opened this issue 8 years ago • 2 comments

I have a tableHeaderView in my UITableViewController that displays some data pulled from Parse. On trying to used this function I get a nil value returned and a crash. Removing it allows the app to run without crashing but does not show the background view setup when the cells are empty. Anything I could be missing?

func verticalOffsetForEmptyDataSet(scrollView: UIScrollView!) -> CGFloat {


        return -tableView.tableHeaderView!.frame.size.height/2.0


}

mhlangagc avatar May 03 '16 14:05 mhlangagc

Well, you should not force unwrap. Use a let guard or if let and the exception should go away. Maybe this callback es called to early, before your tableHeaderView is initialised. Try that out first.

dzenbot avatar May 13 '16 12:05 dzenbot

-tableView.tableHeaderView!.frame.size.height/2.0 is fit to top tableView?

sugitatestblue avatar Jun 22 '22 07:06 sugitatestblue