CCBottomRefreshControl
CCBottomRefreshControl copied to clipboard
AutoLayout crash
"NSLayoutConstraint for (null): Constraint must contain a first layout item" line 222: UITableView *tableView = self.brc_context.fakeTableView; is nil
I got same issue when i used in a UITableViewController, as a UISearchController's results controller.
~~I think, because a UITableViewController's tableView doesn't have a superView, so [self brc_insertFakeTableView]; (L305) were not called.~~, see Issue 11
And than, the tableView will dealloc, because context.fakeTableview is weak property.
By the way, you can use in UIViewController which has a UITableView, as same as Demo, it will be all right.
And, needs be set after tableView added to superView, if not, refreshControl were not showing.
I use these with uicollectionView. I created two kind of app, with and without storyboard. Without storyboard works fine. ok thx for advice
Moving my code to
- (void)viewDidAppear:(BOOL)animated
fixed it for me. I thought viewDidLoad would be sufficient but apparently it was not haha
EDIT: The table is part of a Master-Detail Application and now the exception is thrown when going back from the Detail to the Master. It looks like the tableView.bottomRefreshControl object is NULL. Any ideas?
Auto layout Crashing when switching between tabs .
NSLayoutConstraint for (null): Constraint must contain a first layout item"
Any ideas?
Setting bottomRefreshControl after you added tableView to view and set the layout constraint of the tableView:
self.view.addSubview(tableView)
tableView.snp.makeConstraints { (make) in
make.top.equalTo(headerView.snp.bottom)
make.left.bottom.right.equalToSuperview()
}
tableView.addBottomRefreshControl(target: self, selector: #selector(loadMoreAction))
Update: In UITableViewController, it's still crash, move to UIViewController or using another framework, like: MJRefresh