WWDC Demo 备忘

wwdc2014#226

  • self-sizing cell for tableView/collectionView

wwdc2014#232

  • Aggregate Data Source
  • 对loading content过程引入state machine

wwdc2014#235

  • 用scrollView实现:下拉出现的view
  • 实现:在不同view间拖放对象

wwdc2014#236

  • Presentation Layer Hit Test
1
2
3
4
5
override func hitTest(point: CGPoint, withEvent event: UIEvent!) -> UIView! {
let superviewPoint = convertPoint(point, toView:superview)
let point = layer.presentationLayer.convertPoint(superviewPoint, fromLayer:superview.layer)
return super.hitTest(point, withEvent:event)
}

wwdc2013#217

  • 实现:内嵌的小scrollView拖动距离超过distance后拖动外部的大scrollView,像iOS锁屏时拖动通知条项反而拖过来九宫密码页

    内嵌scrollView的宽要设为2 * (pageWidth + distance)。若设为 2 * pageWidth,由于被distance占用了一段拖动距离,当内嵌scrollView拖到头时没法把外部scrollView全拖过来。

    设置外部scrollView的contentOffset.x时,内嵌scrollView因为是它的子view也会移动,这样就导致移动距离加倍,需要反方向translate回去

  • 实现:在拖动放手后,内外两个scrollView以不同速率回到同一点

    在内嵌scrollView的scrollViewDidScroll:里按速率比调节外部scrollView的contentOffset.x

  • 实现:快速滑动浏览列表项时的弹簧效果:

    UIDynamic可方便配合UICollectionViewFlowLayout子类

wwdc2012#223

  • 用UIPageViewController实现photo browsing

wwdc2012#228

  • 讲AutoLayout怎么debug

wwdc2012#232

  • 用Instruments调试AutoLayout错误

参考

UIScrollView

  • 2009 - Mastering iPhone Scroll Views: basic
  • 2010 - Designing Apps with Scroll Views: photo browsing, tiling
  • 2011 - Advanced Scroll View Techniques: infinite scrolling, stationary views, interaction with gestures
  • 2012#223 - Enhancing User Experience with Scroll Views: photo browsing 2.0, scrolling with OpenGL, custom deceleration
  • 2013#217 - Exploring Scroll Views in iOS 7: nested scroll views, integration with dynamics
  • 2014#235 - Advanced ScrollViews and Touch Handling Techniques