teambition / TBEmptyDataSet

An extension of UITableView/UICollectionView's super class, it will display a placeholder emptyDataSet when the data of tableView/collectionView is empty.
MIT License
206 stars 29 forks source link

Issue with prefersLargeTitles set to true #21

Open csr opened 5 years ago

csr commented 5 years ago

Hey there, there seems to be an issue when the navigation bar prefersLargeTitles property is set to true. Do you perhaps know why this is happening? I've attached an image. Edit: this is always happening regardless of prefersLargeTitles.

Edit: I installed the framework through Carthage: github "teambition/TBEmptyDataSet". Edit: it happens on iPhone X and older devices as well.

test3

csr commented 5 years ago

Code:

class TestController: UITableViewController, TBEmptyDataSetDelegate, TBEmptyDataSetDataSource {

override func viewDidLoad() {
    super.viewDidLoad()
    tableView.emptyDataSetDataSource = self
    tableView.emptyDataSetDelegate = self
    tableView.backgroundColor = .black
    tableView.tableFooterView = UIView()
}

func titleForEmptyDataSet(in scrollView: UIScrollView) -> NSAttributedString? {
    let attributedString = NSAttributedString(string: "EMPTY_STATE_TITLE".localized(), attributes: [NSAttributedString.Key.foregroundColor: UIColor.white])
    return attributedString
}

func descriptionForEmptyDataSet(in scrollView: UIScrollView) -> NSAttributedString? {
    let attributedString = NSAttributedString(string: "EMPTY_STATE_DESCRIPTION".localized(), attributes: [NSAttributedString.Key.foregroundColor: UIColor.white])
    return attributedString
}

func imageForEmptyDataSet(in scrollView: UIScrollView) -> UIImage? {
    return #imageLiteral(resourceName: "empty-state-image")
}    
}

I'm currently using an offset of -100 for now with the hope this gets fixed.