Friday 15 May 2015

swift - Add a scroll view to a set view hierarchy -


I have a visual controller with many sub-views, all connections have been created. I've found that now let me see to allow all the contents of a scroll smaller screen sizes.

My question is how do I add a scroll view to the top of the visual hierarchy and scroll all the scenes?

In advance thank you

Make the first UIScrollView Will require all your subviews, then you can repeat through all your top-level subviews and transfer them from your supervision and instead of the scroll view.

Your UIViewController :

  // You need to handle auto-size, frame adjustments, and auto-layout content, view it in the view itself For scrollView = UIScrollView (frame: self.view.frame), go to {//} Take all the subviews in the main view of the scroll view for the subView in the selfview.view.subviews [UIView] {subView.removeFromSuperview () scrollView Enter the .addSubview (subView)}} // scroll view as the first subview self.view.insertSubview (scrollView) As mentioned, you can see these views (automatically Layout and facade, barriers, etc.) will handle. 


No comments:

Post a Comment