简介:NSLayoutConstraint'的观点是不是一个关键的观点dictionary`
是的,我已经通过所有的,涉及到这个问题的问题看,没有一个答案帮助。下面的代码一直在抛我NSInvalidArgumentException
异常,我仍然无法看到它有什么问题。
问:
我用尽了一切我可能可以尝试。它仍然会像以前一样崩溃,并出现相同的错误信息; 'Unable to parse constraint format: sceneView is not a key in the views dictionary.'
。
这是我做的:
- (SCNView *)sceneView { // Lazy Load
if (_sceneView == nil) {
_sceneView = [[SCNView alloc] initWithFrame:self.bounds];
_sceneView.backgroundColor = [UIColor blackColor];
_sceneView.scene = self.scene; // Load scene
_sceneView.translatesAutoresizingMaskIntoConstraints = NO;
}
return _sceneView;
}
然后在-(void)commonInit
,我添加:后
if ([self.sceneView isDescendantOfView:self] == NO) {
[self addSubview:self.sceneView];
}
[self.sceneView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[sceneView]|"
options:0
metrics:nil
views:NSDictionaryOfVariableBindings(self.sceneView)]];
的权利,它与异常终止。为什么?