
automaticallyAdjustsScrollViewInsets.png

default.png

extendedLyoutIncludesOpaqueBars.png

isTranslucent.png

edgesForExtendedLayout.png

這張圖說(shuō)明了一切
觀察中間紅色按鈕的位置,可以了解到self.view.frame的起始位置不同
btn.center = self.view.center
創(chuàng)建scrollView的代碼,frame = self.view.bounds
scrollView = UIScrollView()
scrollView.frame = self.view.bounds
scrollView.backgroundColor = UIColor.lightGrayColor()
scrollView.contentSize = CGSize(width: 0, height: 1000)
view.addSubview(scrollView)
紅色和藍(lán)色視圖的設(shè)置,注意紅色視圖的frame.origin.y
let redView = UIView()
redView.frame.origin = CGPoint(x: 10, y: scrollView.frame.size.height - 164)
redView.frame.size = CGSize(width: 100 , height: 100)
redView.backgroundColor = UIColor.redColor()
scrollView.addSubview(redView)
let blueView = UIView()
blueView.frame.origin = CGPoint(x: 10, y: 0)
blueView.frame.size = CGSize(width: 100 , height: 100)
blueView.backgroundColor = UIColor.blueColor()
scrollView.addSubview(blueView)
第一頁(yè)是默認(rèn)展示效果
第二頁(yè)是自定義視圖效果
第三頁(yè)是滑動(dòng)不經(jīng)過(guò)navigationBar效果
另外下面有詳細(xì)介紹的,最近比較忙,等筆者有時(shí)間再整理
http://www.myexception.cn/operating-system/1809934.html