objective c - constraints cause an ambiguousLayout -
i have nswindow instance have setupui method. -(void) setupui { nsview* subview = [[nsview alloc] initwithframe:nszerorect]; subview.wantslayer = yes; subview.layer.backgroundcolor = [[nscolor greencolor] cgcolor]; [self.contentview addsubview:subview]; [self.contentview settranslatesautoresizingmaskintoconstraints:no]; [self.contentview addconstraint:[nslayoutconstraint constraintwithitem:self.contentview attribute:nslayoutattributeleading relatedby:nslayoutrelationequal toitem:subview attribute:nslayoutattributeleading multiplier:1 constant:0]]; [self.contentview addconstraint:[nslayoutconstraint constraintwithitem:self.contentview attribute:nslayoutattributetop relatedby:nslayoutrelationequal