ios - Subviewing an XIB having Auto-layout -
i have created xib , used autolayout. showing if check in preview pan.
now tried load nib , add subview viewcontroller using following code:
mynibview = [[nsbundle mainbundle]loadnibnamed:@"customnib" owner:self options:nil].lastobject; mynibview.translatesautoresizingmaskintoconstraints = no; [self.view mynibview];
this time scattering views shown in image below.
i enable logging , checked frame of subview, frame of xib(subview) changed per view of uiviewcontroller subviews of xib didn't arranged that.
2015-03-21 14:38:13.527 [3015:77723] newsubview.frame before = {{0, 0}, {420, 613}} 2015-03-21 14:38:13.633 [3015:77723] containerview.bounds after = {{0, 0}, {320, 504}} 2015-03-21 14:38:13.634 [3015:77723] newsubview.frame after = {{0, 0}, {320, 504}}
is there idea, how add xib subview retaining auto layout constraints work there in xib ?
do not use mynibview.translatesautoresizingmaskintoconstraints = no; because remove constrains view
Comments
Post a Comment