If you add this at the beginning of your setup view method, we won't be left with previous buttons when you change the colour programatically: for view in self.subviews { view.removeFromSuperview() }