ios - View loaded from nib not resizing correctly when embedded in container view -
i have couple of view controllers/views complex nibs reuse in different projects. attempting building container view controller in new project , embedding view controller in container. view being loaded nib in project.
although original project more complex, have built sample project illustrate problems having. sample project has classes , files described below
1) csmsketchview (.h , .m) -- allows user draw on screen
2) csmsketchviewcontroller (.h , .m) -- used control sketch view , manage undo/redo/clear buttons.
3) csmsketchviewcontroller.xib -- contains layout information sketch view
in xib file, undo/redo/clear buttons placed in container view empty spacer views between them shown below. orange , yellow boxes spacer views , blue on right end of container view. have added buttons on left, right , bottom of xib. there autolayout constraints keeping these buttons centered , 20 away edge of view. there autolayout constraints pinning line of buttons , views in container view container view, while allowing width of spacer views fluctuate.
my main storyboard has 1 view csmsketchviewcontroller embedded in container view shown below.
when run program views laid out shown below.
there 2 problems -- container view buttons not stretch should, , button should @ bottom of view @ top of view. have done research , watched few of videos wwdc 2012 , come conclusion csmsketchview owned csmsketchview controller not being resized after embedded in container view.
my thought need add line or 2 of code instruct csmsketchview resize it's frame after embedded in container. unfortunately, not sure line(s) of code appropriate or add code.
Comments
Post a Comment