CCBottomRefreshControl icon indicating copy to clipboard operation
CCBottomRefreshControl copied to clipboard

AutoLayout crash

Open quba88 opened this issue 8 years ago • 6 comments

"NSLayoutConstraint for (null): Constraint must contain a first layout item" line 222: UITableView *tableView = self.brc_context.fakeTableView; is nil

quba88 avatar Feb 27 '17 09:02 quba88

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.

meilbn avatar Mar 01 '17 03:03 meilbn

I use these with uicollectionView. I created two kind of app, with and without storyboard. Without storyboard works fine. ok thx for advice

quba88 avatar Mar 01 '17 13:03 quba88

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?

Reiszecke avatar Aug 14 '17 09:08 Reiszecke

Auto layout Crashing when switching between tabs .
NSLayoutConstraint for (null): Constraint must contain a first layout item" Any ideas?

pavithra123456 avatar Jan 05 '18 09:01 pavithra123456

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))

meilbn avatar Dec 06 '18 13:12 meilbn

Update: In UITableViewController, it's still crash, move to UIViewController or using another framework, like: MJRefresh

meilbn avatar Aug 26 '19 03:08 meilbn