如何在 AutoLayout 中使用 UIScrollView (多个ContentView)

http://codehappily.wordpress.com/2013/11/14/ios-how-to-use-uiscrollview-with-autolayout-pure-autolayout-

 

approach-multiple-smaller-views/

AutoLayout UIScrollView ScrollView 3 view ScrollView ContentView

: https://github.com/djsison/iOS-ScrollView-AutoLayout-MultipleContents view ScrollView

iOS: How to use UIScrollView with Auto Layout (PureAuto Layout) – Single Content View

AutoLayout https://developer.apple.com/library/ios/technotes/tn2154/_index.html

View (UIViewController view)

  • ·  Scroll View (UIScrollView)–

  • ·  Container View (UIView) –

  • ·  Content1 (UIView) –

  • ·  Content2 (UIView) –

  • ·  Content3 (UIView) – :

 

:

 

Scroll view

Scroll View Scroll View contentSize

Scroll View Content1Content2Content3

Container View topbottomleft right

content view

Scroll View Scroll View Scroll View ed with exit code 1


ScrollView topleftrightbottom ScrollView

Scroll View ContentSize

 

 

Scroll View (UIScrollView): superview leading, trailing, top, bottom 20 20 0 View Controller view
Container View (UIView): Scroll Viewleading, trailing, top, bottom 0

 

leading, trailing, top, bottom 0Container View 3 Content views ScrollView ScrollView
Content1: 100 240leading trailing 20top 8bottom 8 Content1 Content2

leading trailing width content1 view Xcode content1 bottom topleftright ScrollView Content2: leading trailing 20 , bottom 8 (Content2 Content3 ), 100 content1 ScrollView contentSize

Content3: leading trailing 20button 20content3 superView ContainerView 100 view ScrollView

 

contentView ScrollView contentView Size Content1 [super viewDidLoad]; self.content1WidthConstraint.constant = 500;

IBOulet.

 

尝试修改content2的高度

-(void)viewDidLoad {

 

[super viewDidLoad]; self.content2HeightConstraint.constant = 200;

}

 

 

 

 

 

 

posted @ 2016-06-21 20:29  sundaysios  阅读(177)  评论(0编辑  收藏  举报