簡介: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)]];
的權利,它與異常終止。爲什麼?