ios - How to get constraints is ios8 before layoutSubviews? -
i have view subclass of uiview,when add constraints in xib,and should array constraints, tried, different between ios 7 , ios 8. work ios 7,and ios 8 invalid.
-(id)initwithcoder:(nscoder *)adecoder{ self = [super initwithcoder:adecoder]; if (self) { nslog(@"constraints = %@",self.constraints); } return self; }
is autolayout turned off xib?
if take 1 of projects, , run on ios8, autolayout turned off, get:
2015-04-29 00:30:48.796 simpletest[37423:4105842] constraints = ( )
if turn autolayout on, list of constraints:
2015-04-29 00:32:03.755 simpletest[37448:4107364] constraints = ( "<nslayoutconstraint:0x7a694c90 v:[_uilayoutguide:0x7a87f280]-(0)-[uibutton:0x7a6834a0'another view']>", "<nslayoutconstraint:0x7a691b90 uibutton:0x7a6834a0'another view'.leading == uiview:0x7a87ef50.leadingmargin>", "<nslayoutconstraint:0x7a6871c0 v:[uibutton:0x7a6834a0'another view']-(100)-[uiview:0x7a87f0f0]>", "<nslayoutconstraint:0x7a696670 uiview:0x7a87f0f0.leading == uiview:0x7a87ef50.leadingmargin + 30>", "<nslayoutconstraint:0x7a691bf0 uiview:0x7a87ef50.trailingmargin == uiview:0x7a87f0f0.trailing + 30>", "<nslayoutconstraint:0x7a686620 v:[uiview:0x7a87f0f0]-(100)-[_uilayoutguide:0x7a87f950]>", "<_uilayoutsupportconstraint:0x7a68d8f0 v:[_uilayoutguide:0x7a87f280(0)]>", etc.
the checkbox turn autolayout on or off near bottom of image:
rereading post, seems adding constraints can't if had autolayout turned off. maybe not issue. however, can see output, ios8 doesn't return nil self.constraints when there constraints.
Comments
Post a Comment