You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CTPanoramaView can also be used both from Objective-C and Swift code.
18
+
CTPanoramaView can be used both from Objective-C and Swift code.
19
19
20
20
## Installation
21
21
@@ -37,50 +37,51 @@ Then run the `pod install` command and use the created workspace to open your pr
37
37
38
38
#### Manual Install
39
39
40
-
Just add the file `CTPanoramaView.swift` (and `CTPieSliceView.swift` if you want to use it as the radar view) to your project.
40
+
Just add the file `CTPanoramaView.swift` (and `CTPieSliceView.swift` if you want to use it as the compass view) to your project.
41
41
42
42
#### Running the Example project
43
43
44
44
The example project is located in the Example directory. The framework target is already added as a dependency to it therefore you can run it directly.
45
45
46
46
## Usage
47
47
48
-
Create an instance of `CTPanoramaView` either in code or using a Storyboard/nib.
48
+
Create an instance of `CTPanoramaView` either in code or using a Storyboard/Nib.
49
49
50
50
Then load a panoramic image and set it as the image of the CTPanoramaView instance:
51
51
52
52
```swift
53
-
// Create an instance of CTPanoramaView called "panoramaView" somewhere
54
-
let image =UIImage(named: "panoramicImage.png")
55
-
panaromaView.image= image
53
+
// Create an instance of CTPanoramaView called "panoramaView" somewhere
CTPanoramaView supports two types of panoramic images:
65
66
66
-
* Spherical panoramas, which are also called 360 photos.
67
-
* Cylindrical panoramas.
67
+
* Spherical panoramas (also called 360 photos)
68
+
* Cylindrical panoramas
68
69
69
-
All panoramas should be full. Partial panoramas (panoramas with a field of view of less than 360º) are not supported. For a spherical panorama, the image should use [equirectangular projections](https://en.wikipedia.org/wiki/Equirectangular_projection). Cubic format is not supported.
70
+
All panoramas should be full. Partial panoramas (panoramas with a field of view of less than 360º) are not supported. For a spherical panorama, the image should use [equirectangular projection](https://en.wikipedia.org/wiki/Equirectangular_projection). Cubic format is not supported.
70
71
71
72
CTPanoramaView will automatically determine whether the given image is a spherical or cylindircal panorama by looking at the aspect ratio of the image. If it is 2:1, then it will assume a spherical panorama. If you want to override this default value, change the value of the `panoramaType` property after the image is set.
72
73
73
74
```swift
74
75
panaromaView.panoramaType= .spherical// or .cylindrical
75
76
```
76
77
77
-
### Control Modes
78
+
### Control Methods
78
79
79
80
CTPanoramaView allows the user to navigate the panorama two different ways. To change the control method, use the `controlMethod` property.
80
81
81
82
```swift
82
-
panaromaView.controlMethod= .Touch// Touch based control
83
-
panaromaView.controlMethod= .Motion// Accelerometer&gyroscope based control
83
+
panaromaView.controlMethod= .touch// Touch based control
84
+
panaromaView.controlMethod= .motion// Accelerometer & gyroscope based control
84
85
```
85
86
86
87
The default control method is touch based control. You can change the control method on the fly, while the panorama is being displayed on the screen. The visible section will get automatically reset during a control method change.
@@ -89,20 +90,20 @@ The default control method is touch based control. You can change the control me
89
90
90
91
All orientations are supported. Orientation changes are automatically handled. Therefore you don't have to worry about things getting messed up after an orientation change.
91
92
92
-
### Radar
93
+
### Compass
93
94
94
-
If you want to display a radar that shows where the user is currently looking at, use the `radar` property.
95
-
When you set this property to a custom `UIView` subclass conforming to the `CTPanoramaRadar` protocol, the view will automatically supplied with rotation and field of view angles whenever one of them changes.
95
+
If you want to display a compass that shows the users current field of view, use the `compass` property.
96
+
When you set this property to a custom `UIView` subclass conforming to the `CTPanoramaCompass` protocol, the view will automatically supplied with rotation and field of view angles whenever one of them changes.
96
97
97
98
```swift
98
-
//radarView is a custom view that conforms to the `CTPanoramaRadar` protocol.
99
-
panaromaView.radar=radarView
99
+
//compassView is a custom view that conforms to the `CTPanoramaCompass` protocol.
100
+
panaromaView.compass=compassView
100
101
```
101
-
The protocol contaions only a single method`updateUI(rotationAngle:fieldOfViewAngle:)`. Here, the `rotationAngle`represents the amount of rotation around the vertical axis, and the `fieldOfViewAngle`respresents the horizontal FoV angle of the camera. Both values are in radians.
102
+
The protocol contains only a single method, which is `updateUI(rotationAngle:fieldOfViewAngle:)`. Here, `rotationAngle`is the amount of rotation around the vertical axis, and `fieldOfViewAngle`is the horizontal FoV angle of the camera. Both values are in radians.
102
103
103
-
You can see an example implementation of a radar in the supplied `CTPieSliceView` class. Add it into your view hierarchy somewhere above the`CTPanoramaView` instance, and then set it as the radar. You'll see that it correctly shows where the user is currently looking at accurately.
104
+
You can see an example implementation of a compass in the supplied `CTPieSliceView` class. Add it into your view hierarchy somewhere above your`CTPanoramaView` instance, and then set it as its compass. You'll see that it correctly shows the current FoV accurately. Here's how `CTPieSliceView` looks in its default configuration:
`CTPieSliceView` has several customizable properties such as `sliceColor`, `outerRingColor` and `bgColor`, all of which can also be modified from the interface builder thanks to its live-rendering support.
0 commit comments