ios - paste one xib onto another xib -
i want paste blue view onto yellow one.
however, no matter how change autolayouts of blue one, there conflicts.
press button in middle, , view show.
add line file maned uiviewcontroller+testalert.m
containerframe.size.width = view.frame.size.width;
just after
containerframe.size.height = view.frame.size.height;
so code of showalertviewb function
if (show) { nsarray* nibviews = [[nsbundle mainbundle] loadnibnamed:@"alertviewb" owner:self options:nil]; alertviewb = (alertviewb*)[nibviews objectatindex:0]; // [alertviewb removeconstraint:alertviewb.containerheightconstraint]; // nslayoutconstraint *newcontainerheightconstraint = [nslayoutconstraint constraintwithitem:alertviewb attribute:nslayoutattributeheight relatedby:nslayoutrelationequal toitem:nil attribute:nslayoutattributeheight multiplier:1.0 constant:view.frame.size.height]; // [alertviewb addconstraint:newcontainerheightconstraint]; cgrect containerframe = alertviewb.container.frame; containerframe.size.height = view.frame.size.height; containerframe.size.width = view.frame.size.width; [alertviewb.container setframe:containerframe]; [alertviewb settranslatesautoresizingmaskintoconstraints:yes]; alertviewb.delegate =self; [alertviewb showwithview:view]; } else { [alertviewb removefromsuperview]; alertviewb = nil; }
Comments
Post a Comment