I know this question has been asked before but I can't seem to make any of the solutions work. I have my buttons set up with AutoLayout, but in order to get them to fit on an iPhone 4 I need to make them shorter.
I have this, which I've tried in viewDidLoad, viewDidAppear, and viewDidLayoutSubviews (I don't really care where it goes so long as it works)
for button in choiceButtons! {
if smallScreen {
button.frame = CGRect(x: button.frame.origin.x, y: button.frame.origin.y, width: button.frame.width, height: 15)
println("small")
} else {
button.frame = CGRect(x: button.frame.origin.x, y: button.frame.origin.y, width: button.frame.width, height: 55)
button.frame.size.height = 55 //second attempt (what I'd really like to work)
print("big")
}
}
The print statements are executing correctly, so I know that works. I've checked the "Placeholder Remove at Build Time" option for all four buttons. I've tried removing the height constraint from the buttons in AutoLayout entirely (it's irrelevant, I'm just trying to keep XCode from yelling at me). Creating all four buttons completely programmatically seems tedious but doable if there's no other option, but I feel like what I'm trying to do shouldn't be too difficult. For what it's worth, if I apply the exact same code to an image, it works. Just not my button.