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:

enter image description here

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:

enter image description here

question:

why gradient hiding uilabel element in auto-layout?

have tried bringing label front?

graphview.bringsubviewtofront(label)


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -