swift - iOS8: viewDidLayoutSubviews() hides elements in Storyboard Auto-Layout -
setup:
i have view controller consists of view
, container view
.
i have setup view
, container view
using class sizes.
the code below adds gradient fine:
class viewcontroller: uiviewcontroller { @iboutlet weak var graphview: uiview! @iboutlet weak var containerview: uiview! let backgroundcolor = cagradientlayer().graphviewbackgroundcolor() override func viewdidload() { super.viewdidload() } override func viewdidlayoutsubviews() { super.viewdidlayoutsubviews() backgroundcolor.frame = self.graphview.bounds self.graphview.layer.addsublayer(backgroundcolor) } }
output:
there no constraints laid out in code.
problem:
however, have label black background not appearing. if comment out following lines, label appears:
//backgroundcolor.frame = self.graphview.bounds //self.graphview.layer.addsublayer(backgroundcolor)
output:
question:
why gradient hiding uilabel element in auto-layout?
have tried bringing label front?
graphview.bringsubviewtofront(label)
Comments
Post a Comment