ios - Container View Not Moving Off Screen -
i have container view want off bottom of screen. should easy, seem missing fundamental. have done similar moving controls off left side of screen with:
control.center.x -= view.bounds.width
i have simple storyboard setup:
and view controller looks this:
class viewcontroller: uiviewcontroller { @iboutlet var containerview: uiview! override func viewwillappear(animated: bool) { super.viewwillappear(animated) containerview.center.y += view.bounds.height } }
when run, container view right shows in storyboard , not offscreen. setting containerview's center.y specific value such containerview.center.y = 50
nothing. way can show off screen adding animation in viewdidappear:
override func viewdidappear(animated: bool) { super.viewdidappear(animated) uiview.animatewithduration(0, animations: {self.containerview.center.y += self.view.bounds.height}) }
but seems workaround , not proper way it. have been dealing hours, reading blogs, reading other stackoverflow questions, cannot find solution. not have constraints on container, although did test constraints , did not make difference. appreciated.
it possible main view's `layoutsubviews called after reposition container view, default position specified in storyboard.
the proper way have proper layout constraints in storyboard, make outlet bottom edge constraint , set constraint's constant
property.
Comments
Post a Comment