一个易于配置的 UIView + UIImageView 来实现视差效果。
构建并运行 JMEParallaxViewExample
Xcode 工作区,以查看 JMEParallaxView
的工作方式。
parallaxView.observingScrollView = tableView;
parallaxView.contentImageView.image = yourImage;
parallaxView.contentDisplayingPercentage = 0.8;
parallaxView.activeRange = [JMEParallaxView activeRangeWithTableView:tableView indexPath:indexPath direction:parallaxView.direction edgeInsets:UIEdgeInsetsZero];
在示例项目中查看更多信息。
JMEParallaxView 通过 CocoaPods 提供,要安装它,只需在 Podfile 中添加以下行
pod "JMEParallaxView"
或者,您也可以手动将 JMEParallaxView
目录下的文件复制到您的项目中。请确保您的项目中包含 KVOController,因为我们使用它来跟踪您的滚动视图。
Jo-Yuan Hsieh
JMEParallaxView 非常感激地使用了以下其他优秀的开源项目
演示图片由 Jo-Yuan Hsieh 慷慨提供(http://instagram.com/jmehsieh)。
JMEParallaxView 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。