So check this out. Inside your method
func setBlueGradientBackground(){
let topColor = UIColor(red: 95.0/255.0, green: 165.0/255.0, blue: 1.0, alpha: 1.0).cgColor
let bottomColor = UIColor(red: 72.0/255.0, green: 114.0/255.0, blue: 184.0/255.0, alpha: 1.0).cgColor
smoke.frame = view.bounds //HERE SEEMS TO BE CULPRIT
smoke.colors = [topColor, bottomColor]
}
we see that you declare smoke's frame. Well, it seems that your smoke variable (of some descent of UIView) was added to the screen somewhere AFTER your button. So maybe something like this happened
var smoke:UILabel = UILabel()
func viewDidLoad() {
var button = UIButton(frame: CGRect(x: self.view.frame.width*0.3, y: self.view.frame.height*0.3, width: self.view.frame.width*0.4, height: self.view.frame.height*0.4))
self.view.addSubview(button) //ADDED BEFORE
self.view.addSubview(smoke) //ADDED AFTER
}
Now the reason that setBlueGradientBackground would FIX this is becuse you set the smoke's frame
inside there. So, if we remove setBlueGradientBackground, we also don't accept smoke's frame. Smoke is now NOT ON THE SCREEN even though it is added as a view; it has no bounds. Therefore, although the button is added AFTER your button, it can't block anything because it has no bounds.
A quick little tool to see where the layers are is this. Inside XCode, when you run the program, on the debugger tool you have these buttons -> Breakpoints, Pause, Skip, Inside, Something Else, and then you have a line that looks like this |. Then you have another button that looks like 2 rectangles, 1 width and 1 height combined, click on that and it will actually pause your program in the given state and show you where the layers are. It's pretty nifty. It is the 6th button below in the picture.
