When I'm extending my UIViewController and calling the extended ViewController I'm getting : Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSLayoutConstraint for (null): Constraint must contain a first layout item' error.
CGSize size = CGSizeMake(142, 200);
[self.scrollView.subviews enumerateObjectsUsingBlock:^(UIView* subView, NSUInteger i, BOOL *stop) {
subView.translatesAutoresizingMaskIntoConstraints = NO;
[ViewHelper addWidthConstraint:subView width:size.width];
[ViewHelper addHeightConstraint:subView height:size.height];
if (i < self.scrollView.subviews.count - 1) {
[ViewHelper addHorizontalConstraint:self.scrollView
previouseView:subView
nextView:(UIView*)self.scrollView.subviews[i + 1]
spacer:8];
}
[ViewHelper addEdgeConstraint:NSLayoutAttributeTop
superview:self.scrollView
subview:subView];
[ViewHelper addEdgeConstraint:NSLayoutAttributeBottom
superview:self.scrollView
subview:subView];
}];
[ViewHelper addEdgeConstraint:NSLayoutAttributeLeft
superview:self.scrollView
subview:self.scrollView.subviews.firstObject];
[ViewHelper addEdgeConstraint:NSLayoutAttributeRight
superview:self.scrollView
subview:self.scrollView.subviews.lastObject];
[ViewHelper addHeightConstraint:self.scrollView height:size.height];
Crashing at this line:
[ViewHelper addEdgeConstraint:NSLayoutAttributeLeft
superview:self.scrollView
subview:self.scrollView.subviews.firstObject];
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)