这是什么?
Image360是一个简单的堆叠,包含Image360Controller + Image360View,允许您显示360°全景图像。
如何使用它?
- 在您的代码中创建一个_image360Controller的实例。
- 将360°图像设置为新创建的实例的
image: UIImage
。 - 使用实例的
inertia: Float
设置手势的惯性。 - 您可以通过
isOrientationViewHidden: Bool
标志关闭特殊的方向子视图(指南针视图)。 - "Image360View"默认由"Image360Controller"通过手势和设备动作控制。您可以通过
isDeviceMotionControlEnabled: Bool
和isGestureControlEnabled: Bool
标志关闭这些功能。
示例
class ViewController: UIViewController {
...
// Image360Controller is inserted to view with container view and bind with "image360" segue
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let identifier = segue.identifier {
switch identifier {
case "image360":
if let destination = segue.destination as? Image360Controller {
destination.image = UIImage(named: "MyPanoramicImage")
}
default:
()
}
}
}
有关更多详细信息,请查看此存储库中的"iOS示例"。
安装
CocoaPods
CocoaPods是一个Cocoa项目的依赖管理器。您可以使用以下命令安装它:
$ gem install cocoapods
要使用CocoaPods将Image360集成到您的Xcode项目中,请在您的Podfile
中指定它:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '<Your Target Name>' do
pod 'Image360', '~> 1.1.5'
end
然后,运行以下命令
$ pod install