NSGenericException', reason: 'Unable to install constraint on view

后端 未结 7 1546
花落未央
花落未央 2020-12-09 16:05

Terminating app due to uncaught exception \'NSGenericException\'

Terminating app due to uncaught exception \'NSGenericException\', reason: \'Unable to

7条回答
  •  没有蜡笔的小新
    2020-12-09 16:34

    I got this problem using a UIPickerView like input of a UITextField (using Autolayout). When I push another viewController and thus a pop it to the viewController with the picker, the app crashes. I found the following solution, in the UIPickerViewController:

    -(void)viewWillAppear:(BOOL)animated{
    
        [self.pickerView removeFromSuperview];
        [self.pickerView setTranslateAutoresizingMaskIntoContraints:YES];
        [self.view addSubview];
    
    }   
    

    You can also set the UIPickerViewPosition after removing from superview. I hope that can help you!

提交回复
热议问题