objective c - Programmatically adding constraints eliminates window resizing -
i have subview created programmatically. it's handling selections when necessary , passing responder chain otherwise. naturally want fill whole window, @ resize. added array of constraints:
-(void)configureconstraintsforsubview:(nsview *)subview{ nsarray *constraints = [nsarray arraywithobjects: //creates constraints [nslayoutconstraint constraintwithitem:self attribute:nslayoutattributeleading relatedby:nslayoutrelationequal toitem:subview attribute:nslayoutattributeleading multiplier:1 constant:0], [nslayoutconstraint constraintwithitem:self attribute:nslayoutattributetrailing relatedby:nslayoutrelationequal toitem:subview attribute:nslayoutattributetrailing multiplier:1 constant:0], [nslayoutconstraint constraintwithitem:self attribute:nslayoutattributebottom relatedby:nslayoutrelationequal toitem:subview attribute:nslayoutattributebottom multiplier:1 constant:0], [nslayoutconstraint constraintwithitem:self attribute:nslayoutattributetop relatedby:nslayoutrelationequal toitem:subview attribute:nslayoutattributetop multiplier:1 constant:0], nil]; [self addconstraints:constraints]; } however, instead of letting me resize view along window, can't resize window @ all! (the zoom button doesn't anything!) console says being unable mutually satisfy constraints, , attempts recover breaking one, doesn't work. few notes code: self pdfview subclass set in interface builder, subview parameter/argument representing subview want constrain. i've never done constraints programmatically before, figure i'm making obvious error.
update: here's relevant portion of error:
2014-03-25 15:40:31.345 <myappname>[3097:303] unable simultaneously satisfy constraints: ( "<nsautoresizingmasklayoutconstraint:0x6100000991e0 h=--& v=--& v:[eglinteractionview:0x6100001fe100]-(-1)-| (names: '|':eglpdfview:0x60800014de10 )>", "<nslayoutconstraint:0x6100000974d0 v:[eglinteractionview:0x6100001fe100]-(0)-| (names: '|':eglpdfview:0x60800014de10 )>" ) attempt recover breaking constraint <nslayoutconstraint:0x6100000974d0 v:[eglinteractionview:0x6100001fe100]-(0)-| (names: '|':eglpdfview:0x60800014de10 )> note class name eglpdfview corresponds self in first snippet, , class eglinteractionview corresponds subview in first snippet.
Comments
Post a Comment