Hello!

The point is this: when opening a view, I load data from the server. And depending on the amount of data received, I try to change the contentSize of the scrollView. Autolayout enabled. Besides, I can’t set the size of contentSize in advance in:

- (void)viewDidLayoutSubviews { scrollView.contentSize = CGSizeMake(320, 3000); } 

I tried to do this instruction , but it also does not work

  • Turn off Autolayout in all cases of working with dynamically expanding areas, in this case ScrollView. - Nuclominus
  • Look at my answer: hashcode.ru/questions/323766/ios7-xcode-autolayout You should do the same. Just declare a height constant and change it. Since what you are trying to do is "hacked" with an autolaute. - dark_Haron
  • And the easiest answer is: - And what's stopping you from adding a UITextView and placing it there? There everything will be done automatically. - dark_Haron
  • and how to work with a different autolayout'om with a different resolution, such as 3.5-inch? And then on 4-4c iphone my tabbar goes off the screen - michilly
  • one
    So ... Read my answer! I gave the link above. Nenad disable anything! But to think and do it differently. Autolauot is a visual thing that is (practically) configured in InterfaceBuilder, it’s almost impossible to manage in code (well, it’s more or less difficult). - dark_Haron

1 answer 1

and draw a view in DrawRect? if so, load the data, before building the view, call the sizeThatFits method: in which you build the view on the data that you loaded but do not display it, pass this size to scrollView and then build your view