AMImageSequenceView
是一个简单的视图,用于在您的 iOS 应用中展示图像序列。此视图旨在查看 360 度旋转的图像。支持 360 度水平旋转和图像缩放。
您可以在以下资源尝试 360 度旋转图像:
http://www.ajax-zoom.com/examples/example15.php
https://www.yofla.com/3d-rotate/examples/backpack-360-view/
将 AMImageSequenceView/AMImageSequenceView
文件夹拖入到您的项目中。
AMImageSequenceView 是 UIView 的子类。此视图有一个子视图 - 用于缩放图像的 UIScrollView
。UIScrollView
有一个子视图 - 带有旋转手势识别器的 UIImageView
。
为了初始化视图,您应该使用以下方法:
[[AMImageSequenceView alloc] initWithImages:imagesArray frame:viewFrame]
imageSequenceView.zoomEnabled = YES; //Default is NO
imageSequenceView.zoomBouncesEnabled = YES; //Default is NO
imageSequenceView.maximumZoomScale = 2.5; //Default is 1.0
请注意,您不能设置 minimumZoomScale
属性,因为它只读,其值始终为 1.0。它是旋转手势识别器正确工作的必要条件。此外,如果当前图像的缩放比例大于 1.0,则您将无法旋转它。
您可以使用以下行来自定义旋转手势识别器的灵敏度(即图像旋转速度):
imageSequenceView.sensivity = 1.5; //Default is 0.8
请注意,灵敏度越高,图像的旋转速度越慢。
您可以使用以下行来启用旋转惯性(类似于 UITableViewDataSource 的滚动,手势结束后继续旋转一段时间):
imageSequenceView.inertiaEnabled = YES; //Default is NO
要设置图像的内容模式,请使用以下命令:
imageSequenceView.contentMode = UIViewContentModeScaleCenter; //Default is UIViewContentModeScaleAspectFit
AMImageSequenceView
遵循MIT许可证的条款和条件。
AMImageSequenceView
由Artem Mihaylov开发。如果您在自己的项目中使用了AMImageSequenceView
,我们非常欢迎您进行署名。