So I just sorted out in this way:
- 
Add in the UIScrollViewaUIView(we can call thatcontentView);
- 
In this contentView, set top, bottom, left and right margins to 0 (of course from thescrollViewwhich is thesuperView); Set also align center horizontally and vertically;
Finished.
Now you can add all your views in that contentView, and the contentSize of the scrollView will be automatically resized according with the contentView.
Update:
Some special case is covered by this video posted by @Sergio in the comments below.
 
        