ios - How to constrain view's width to device width in interface builder? -
i have view hierarchy
i want content grow vertically in content view not horizontally. want constrain contentview's width same device's width. how can in interface builder?
note: image's width in image view bigger device's width, right contentview's size grows both vertically , horizontally
just add constraints content view leading space,trailing space,top space,bottom space along fix content view width constraint constant , create outlet width constraint value , in view controller side write method as
-(void)viewdidlayoutsubviews {
_scrollviewcontentviewwidthconstraint.constant = self.view.frame.size.width;
}
Comments
Post a Comment