ios - I programmatically created rectangles, and added buttons on storyboard and the buttons are getting covered by the rectangles. How do I fix that? -


i programmatically created rectangles, , added buttons on storyboard , buttons getting covered rectangles. how fix that?

import uikit  class interestviewcontroller: uiviewcontroller {  var squareview: uiview!  var gravity: uigravitybehavior!  var animator: uidynamicanimator!  var collision: uicollisionbehavior!  override func viewdidload() {     super.viewdidload()      squareview = uiview(frame: cgrectmake(100, 100, 100, 100))      view.addsubview(squareview)  } 

as @matt mentioned subviews , views ordered in window. have different way want :

you can insert rectangle @ given index if know :

self.view.insertsubview(squareview atindex:index)

if have reference uibutton can either :

self.view.insertsubview(square, belowsubview:button)

or after adding squareview using :

self.view.addsubview(squareview)

call following :

self.view.sendsubviewtoback(squareview)

all methods referenced in uiview class reference


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -