Dlaczego otrzymuję komunikat „Wymagany jest automatyczny układ po wykonaniu -layoutSubviews” przy każdym uruchomieniu aplikacji?
Odkąd dodałem następujący kod, za każdym razem, gdy otwiera się moja aplikacjaUITableViewController
zawiesza się:
self.noArticlesView = [[UIView alloc] init];
self.noArticlesView.translatesAutoresizingMaskIntoConstraints = NO;
self.noArticlesView.backgroundColor = [UIColor colorWithRed:0.961 green:0.961 blue:0.961 alpha:1];
[self.view addSubview:self.noArticlesView];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.noArticlesView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.noArticlesView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.noArticlesView attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0.0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.noArticlesView attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0.0]];
I daje mi ten błąd:
* Zakończenie aplikacji z powodu nie przechwyconego wyjątku „NSInternalInconsistencyException”, powód: „Układ automatyczny jest nadal wymagany po wykonaniu -outoutSubviews. Implementacja -layoutSubviews przez UITableView musi zadzwonić do super.
Co, u licha, robię źle? Dzwonię pod ten kodtableView:numberOfRowsInSection:
gdy jest 0 wierszy.