我正在尝试通过代码构建一个视图。在我的init函数中,我有以下代码:
- (id) init{
self = [super init];
if(self){
[self setFrame:CGRectMake(0, 0, 0, 50)];
[self addSubview:[self dateNumberView]];
NSDictionary *views = NSDictionaryOfVariableBindings(self.dateNumberView);
[self.dateNumberView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-[dateNumberView]-|" options:0 metrics:nil views:views]];
}
return self;
}
我收到的错误消息是:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse constraint format: dateNumberView is not a key in the views dictionary. |-[dateNumberView]-|
有什么问题吗?