I have problem that is simply explained but boggles my mind.
I am having an issue changing scrollview content size while simply tapping a button with the following code
if condition {
scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width, 1000 )
button.setTitle("SHOW LESS", forState: .Normal)
} else {
scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width, 200 )
button.setTitle("SHOW MORE", forState: .Normal)
}
I am using auto layout, I am aware of the problems that arise with frames not being set yet during the view lifecycle and causing mishaps but this code is executed in an IBAcition. The strange thing is, if the content size is greater than 200 to start, it will shrink. It just never grows to 1000. My only guess is that it has to do with the constraints linked to the button which are nothing special, just centered and pinned vertically but I would have no idea where to start debugging that. Also when I remove the set title call, it DOES grow to 1000! I can't for the life of me figure out why setting the title would mess with content size. Any ideas?